반응형

 

SyntaxHighlighter

http://alexgorbatchev.com/SyntaxHighlighter/

 

 

About

SyntaxHighlighter is a fully functional self-contained code syntax highlighter developed in JavaScript. To get an idea of what SyntaxHighlighter is capable of, have a look at the demo page.

SyntaxHighlighter is currently used by Apache, Aptana, Mozilla, Yahoo, Wordpress, Bug Labs, Freshbooks and others.

Demo

1
2
3
4
5
6
7
// SyntaxHighlighter makes your code snippets beautiful without tiring your servers.
var setArray = function(elems) {
    this.length = 0;
    push.apply(this, elems);
    return this;
}

News

  • I work at SAY: Media and we are hiring engineers! Oh, and the ad on the right is just one of the many awesome things we do! October 5, 2011
  • We aren’t dead! Moved source to GitHub to increase participation. July 26, 2011
  • Major new 3.0.83 release (changes). July 2, 2010
  • New 2.1.382 release (changes). June 24, 2010
  • Follow @syntaxhighlight on Twitter. March 1, 2010
  • New 2.1.364 release (changes). October 15, 2009
  • Freshbooks is using SyntaxHighlighter! October 8, 2009
  • ASP.NET forums using SyntaxHighlighter! July 1, 2009
  • Bug Labs is using SyntaxHighlighter! June 24, 2009
  • Maintenance release 2.0.320 (changes). May 3, 2009
  • Set up a public repository on Bitbucket. March 8, 2009
  • Maintenance release 2.0.296 (changes). March 1, 2009
  • Maintenance release 2.0.287 (changes). February 6, 2009
  • SyntaxHighlighter 2.0 goes public. Yay
반응형
반응형
Best jQuery Chart Libraries for Building Interactive Charts

 

http://codegeekz.com/best-jquery-chart-libraries-for-building-interactive-charts/

1. Chart.js : Charting Library with HTML5 Canvas

chartjs
Chart.js is an impressive JavaScript charting library that is built on top of HTML5 canvas. It currently supports 6 chart types (line, bar, radar, pie, column and polar area) and all this comes in a standalone, less than 5kb package. Colors, fonts, borders and their sizes can all be customized. Also, optionally, charts can be loaded with an animation.

Source

2. xCharts : For Building Data-Driven Charts

xcharts
xCharts is a JavaScript library for building beautiful and custom data-driven chart visualizations for the web using D3.js. Using HTML, CSS, and SVG, xCharts are designed to be dynamic, fluid, and open to integrations and customization.

Since xCharts use SVG, we are able to accomplish most of our styling of xCharts directly through CSS. This means you have quite a bit of control to handle the visualization however you want. The best way to style charts is to start with the included stylesheet, or use your browser’s element inspector to see each elements CSS class selectors that are available to use.

Source

3. Sigma.js : Draw Graphs Using HTML5 Canvas Element

sigma-js
Sigma.js is a free and open-source JavaScript library to draw graphs, using the HTML5 canvas element. It has been especially designed to share interactive network maps on a Web page or to explore dynamically a network database. It is distributed under the MIT License.

Source

4. HighCharts

highchartjs
Highcharts is a charting library written in pure HTML5/JavaScript, offering intuitive, interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.

Source

5. Fusion Charts

fusion-charts
The FusionCharts jQuery plugin helps you add interactive JavaScript charts and graphs to your web, mobile and enterprise applications. It combines the delight and comprehensiveness of FusionCharts Suite XT with the easy-to-use jQuery syntax.

Source

6. Flot : Attractive JavaScript Plotting for jQuery

flot
Flot is a pure JavaScript plotting library for jQuery, with a focus on simple usage, attractive looks and interactive features. Some key features of plot is turning series on/off, zooming, interacting with the data points and it integrates a simple tooltip feature.

Source

7. JS Charts : Free JavaScript Charts

jscharts
JS Charts is a JavaScript based chart generator that requires little or no coding. With JS Charts drawing charts is a simple and easy task, since you only have to use client-side scripting (i.e. performed by your web browser). No additional plugins or server modules are required. Just include our scripts, prepare your chart data in XML, JSON or JavaScript Array and your chart is ready!

Source

8. jQuery Sparklines

jQuery-Sparklines
This jQuery plugin generates sparklines (small inline charts) directly in the browser using data supplied either inline in the HTML, or via javascript. The plugin is compatible with most modern browsers and has been tested with Firefox 2+, Safari 3+, Opera 9, Google Chrome and Internet Explorer 6, 7, 8 & 9 as well as iOS and Android.

Source

9. Morris.js : Draw Time-Series Line Graphs

morrisjs
Morris.js is a lightweight library that uses jQuery and Raphaël to make drawing time-series graphs easy. Morris.js started life as the code that powered the graphs on howmanyleft.co.uk. Now it’s been open-sourced for the whole world to extend and enjoy.

Source

10. jQuery OrgChart

jquery-org-chart
jQuery OrgChart is a plugin that allows you to render structures with nested elements in a easy-to-read tree structure. To build the tree all you need is to make a single line call to the plugin and supply the HTML element Id for a nested unordered list element that is representative of the data you’d like to display.

Source

11. jgPlot

jqPlot
jqPlot is a plotting and charting plugin for the jQuery Javascript framework. jqPlot produces beautiful line, bar and pie charts with many features like rotated axis text, automatic trend line computation, tooltips and data point highlighting, sensible defaults for ease of use and many more.

Source

12. Grafico

grafico
Grafico is a javascript charting library built with Raphaël and Prototype.js. The library provides a wide array of graphs and stays with the guidelines laid out by Stephen Few and Edward Tufte. Grafico provides pretty charts that effectively communicate their information.

Source

13. GraphUp

graphup
GraphUp is a very flexible and lightweight jQuery (v1.4+) plugin to spice up your data tables. It visualizes the values using color, bar charts and bubbles.

Source

14. dygraphs

dygraphs-javascript
dygraphs is an open source JavaScript library that produces produces interactive, zoomable charts of time series. It is designed to display dense data sets and enable users to explore and interpret them. You can mouse over to highlight individual values. Click and drag to zoom. Double-click to zoom back out. Change the number and hit enter to adjust the averaging period.

Source

15. jsPlumb jQuery Plugin

jsplumb
jsPlumb jQuery plugin provides a means for a developer to visually connect elements on their web page, in much the same way you might have seen on Yahoo Pipes. jsPlumb allows you to connect elements on the screen with “plumbing”, using a Canvas element when supported, and Google’s Explorer Canvas script to support older browsers. Full transparent support for jQuery dragging is included, the API is super simple, and the compressed version of the script is just 10.5K.

Source

 

 

Best jQuery Chart Libraries for Building Interactive Charts Code Geekz.mht

 

반응형
반응형

Android Simulator Setup for Sencha Touch

 

http://www.sencha.com/blog/android-setup-for-sencha-touch/

 

Sencha Touch applications developed for Android devices should be tested in the Android simulator as part of your development process. This blog post discusses how to install and use the Android simulator, for Sencha Touch applications developed with either the command line tools or Sencha Architect.

The number of Android smartphones being sold and used has recently surpassed iOS smartphones. (This Time magazine article from April 2013 breaks down the numbers).

Many Sencha Touch developers are targeting the Android platform. This blog post will show you how to set up an Android development environment from start to finish. The screenshots and directory names are Mac-centric. The process for Linux is almost identical, and the process for Windows is very similar.

1. Install Android SDK Tools

Summary

Install the Android SDK Tools: download the proper file for your operating system.

Discussion

On the download page, click the dropdown for "Download for Other Platforms" and download the "SDK Tools Only" zip file for your operating system. (For Windows, download the zip file, not the installer.exe).

What you're downloading is not the SDK itself, but a zip file that contains the installer for the rest of the SDK. We will use the SDK tools to download the actual emulator in the next section.

Unzip the Android SDK Tools to the "bin" directory in your home directory, which you may have to create.

Mac OS

For Mac OS, save the file to /Users/username/bin (create the "bin" directory if it doesn't exist). The full path to your Android SDK directory on Mac is /Users/username/bin/android-sdk-macosx/.

Linux

For Linux, save the file to /home/username/bin (create the "bin" directory if it doesn't exist). The full path to your Android SDK directory on Linux is /home/username/bin/android-sdk-linux/.

Windows

If you're using Windows 7, Windows puts your personal files in the directory C:\Users\username. If you've already installed Sencha Cmd (see below), the C:\Users\username\bin directory has already been created for you, otherwise you can create it. Unzip the Android SDK under the bin directory. For Windows, the full path to the Android SDK is C:\Users\username\bin\android-sdk-windows.

2. Install the Android emulator

Summary

Using the Android SDK Manager (that you just downloaded), install the Intel-based Android emulator.

Discussion

Android and Sencha Touch

In the Android SDK directory, under the "tools" subdirectory, you'll find an executable file called "android". Double-click on it to launch the Android SDK Manager.

Android and Sencha Touch

Uncheck the box next to "Android 4.2.2 (API 17)". This will uncheck all the boxes in that section. The only box you need to check is "Intel x86 Atom System Image". You can leave the checkboxes next to "Platform tools" and "Build-tools" checked if you want.

Since we are using Sencha Touch to develop our Android apps, we don't need to install any of the other products.

Here are the final steps to finish the install:

  1. Click "Install 4 packages..." to download and install your Android packages.
  2. Click on the package headers, and click "Accept License".
  3. The progress bar at the bottom will show you the progress of the install. Wait until all your packages have been installed.

3. Configure and start up the Android emulator

Summary

To test our emulator download, we'll configure the emulator for its first run, then start it up to see if it's working properly.

Discussion

After all your packages have downloaded in the previous step, select the "Tools → Manage AVDs..." menu item in the Android SDK tools.

Android and Sencha Touch

A dialog will appear showing you all the virtual Android machines that you've defined. Since this is the first time that you've run this command, there are no machines shown. Click the "New..." button to define a new machine.

Android and Sencha Touch

Fill in the name, type of device, and the API level (17 in our case). Also, make sure the "Use Host GPU" checkbox is checked. Click OK to accept these settings, and click OK to accept the summary screen.

Android and Sencha Touch

You've configured your first Android emulator, and you should see a green check in front of your virtual Android device. On the right side of the dialog, click "Start..." to start up the emulator. On the following screen, click "Launch".

Android and Sencha Touch

If you've installed everything correctly, the Android emulator will start up. Depending on the speed of your machine, the startup process may take several minutes. When the emulator starts up, you should see the screen below.

Android and Sencha Touch

Click on the circle to see the applications that are already installed in this emulator. If you're able to see this screen, then you have installed and configured your Android emulator correctly.

Additional steps for Linux 64-bit

The Android emulator file is a 32-bit binary. To run 32-bit binaries on your 64-bit Linux system, you will need to install 32-bit libraries for your version of Linux. On many Linux systems, this is not done by default.

If you get an error message similar to "emulator: file not found" even though you can see the emulator file right there in your "tools" directory, then you have to install 32-bit loaders for your 64-bit Linux system.

Ubuntu/Debian: type "sudo apt-get install ia32-libs"

Red Hat/Fedora: read the docs

Other flavors of Linux: Google "<Linux flavor> 32 bit loader for 64 bit system" or something similar

4. Generate an Android certificate

Summary

Create a certificate to use when downloading programs to the Android emulator or testing on the physical Android device.

Discussion

To generate a certificate usable with your Android emulator, you will be using the "keytool" program that comes with Java, so you must have Java SE 1.6 or higher installed on your machine. This is already installed if you’re using a Mac, and is most likely already installed on your Windows machine.

From the Terminal or a command prompt, type "keytool". If the command is not found, you may need to go to java.com, and download Java SE 1.6 or higher.

For simplicity, we’ll create the keystore in the Android SDK directory, and we’ll set the keystore, alias, and password all to "android1". (For a real certificate you would not set such obvious values for the keystore and password, but we're trying to keep things simple for our demo.)

Here's what the dialog looks like:

$ pwd
/User/username/bin/android-sdk-macosx
$ keytool -genkey -v -keystore android1.keystore -alias android1 -keyalg RSA -keysize 2048 -validity 10000
Enter keystore password: (I entered "android1")
What is your first and last name?
  [Unknown]: Patrick Chu
What is the name of your organizational unit?
  [Unknown]: Training
What is the name of your organization?
  [Unknown]: Sencha
What is the name of your City or Locality?
  [Unknown]: Redwood City
What is the name of your State or Province?
  [Unknown]:  California
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=Patrick Chu, OU=Training, O=Sencha, L=Redwood City, ST=California, C=US correct?
  [no]:  yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 10,000 days
    for: CN=Patrick Chu, OU=Training, O=Sencha, L=Redwood City, ST=California, C=US
Enter key password for <android1>
    (RETURN if same as keystore password):  
[Storing android1.keystore]
$

At this point, you have a file called "android.keystore" that contains your certificate. You will need this file to package a Sencha Touch app into a "native" Android application.

5. Edit packager.json

Summary

Edit "packager.json" to reflect details about the Android emulator environment and the certificate file that you generated above.

Discussion

In this step, we’re going to generate a demo Sencha Touch app, so we have something to load into the Android simulator. To do this, I'm going to make some assumptions about your Sencha Touch environment:

  • The root of your localhost web server is a folder called "htdocs". This is the default if you installed Apache using XAMPP.
  • Your Sencha Touch files are in the directory "htdocs/touch2"
  • You've already installed Sencha Cmd. To test, type "sencha" from the Terminal or command prompt. If you see a Sencha Cmd help screen, then Sencha Cmd is installed. If the command is not found, install Sencha Cmd

Change directory to "htdocs/touch2", and enter the following command:

  • sencha generate app --name AndroidDemo --path ../demo
  • For Windows, the directory is "..\demo"

It’s OK if the htdocs/demo directory doesn't exist -- Sencha Cmd will create it. When the command completes, you will have a simple but complete Sencha Touch application. If your web server is running, you can see it running at http://localhost/demo.

To tell this application about the details of our Android environment, we have to edit the "htdocs/demo/packager.json" file. Here are the properties that we need to edit, common to all platforms:

  • "applicationId": "com.demo.AndroidDemo", /* (this must contain at least 2 parts separated by periods) */
  • "platform": "AndroidEmulator",
  • "certificateAlias": "android1",
  • "certificatePassword": "android1",
  • "androidAPILevel": "17",

Mac OS

Properties specific to Mac OS:

  • "certificatePath": "/User/username/bin/android-sdk-macosx/android1.keystore",
  • "sdkPath": "/User/username/bin/android-sdk-macosx",
  • Substitute "username" with your username

Linux

Properties specific to Linux:

  • "certificatePath": "/home/username/bin/android-sdk-linux/android1.keystore",
  • "sdkPath": "/home/username/bin/android-sdk-linux",
  • Substitute "username" with your username

Windows

Properties specific to Windows:

  • "certificatePath": "C:/User/username/bin/android-sdk-windows/android1.keystore",
  • "sdkPath": "C:/User/username/bin/android-sdk-windows",
  • Substitute "username" with your username
  • Yes, you can and should use FORWARD slashes in your Windows path

Save your edits to the file.

You’re almost done! Now all we have to do is run our program in the Android emulator. Here are the steps:

  • Start your Android emulator. It has to be running at the time that Sencha Cmd attempts to send it the application's files
  • Change directory to "htdocs/demo" (the root of your application, where your packager.json file lives)
  • Type: sencha app package run packager.json

(Note: your Java executable must be somewhere in your path in order for Sencha Cmd to work)

If you're lucky (and patient), you should see the sample application start in your Android emulator! Congratulations!

Click on the tabs at the bottom to move between screens in the sample app.

6. (optional) Install Intel’s hardware acceleration drivers for the Android emulator

Summary

Install hardware acceleration for the Android emulator to improve performance. This step is HIGHLY recommended.

Discussion

While running your Sencha Touch program inside your Android emulator, you may notice that it runs a bit "sluggish" (the most polite term I could think of). Since the emulator is implemented completely in software, it’s always been slow.

However, if you’re running on an Intel-based Mac or Windows machine, you can use Intel drivers that provide hardware acceleration for the Android emulator, in the same way that VMWare’s or Hyper-V’s virtual machines are also hardware assisted. Your Intel processor has to support Intel’s Virtualization Technology (VT) in order for the drivers to work. Intel’s name for this package is HAX, short for "Hardware AXceleration".

You can download the software from this page.

The page also contains links to very detailed installation instructions for all supported platforms. After you install the software, you will notice that the Android emulator runs much faster.

NOTE: You’ll notice that, in the Android Package SDK tool, HAXM is listed at the bottom as a possible install. I've had problems installing HAX this way. Instead, go to the link above and install it from that page.

NOTE: If you are running Hyper-V in Windows 7 on your PC, you will have to disable it in order for Intel’s hardware acceleration to work. Hyper-V will lock up the virtualization feature for itself, thus preventing other virtualization programs from running.

7. More resources

Below I&rsquo've listed two useful Android development features that I don't have room to cover in this blog post.

  • Chrome Mobile Emulation:Within Chrome, you can simulate touch events, screen resolutions, device user agents, device orientation, and geolocation, all from within Chrome. This allows you to perform the bulk of your development and debugging in the host’s browser, which is much faster, and then run the application in the simulator as a once-a-day test and sanity check.
  • Remote Debugging on Android:Use Chrome on your host to debug web applications in your Android browser.
반응형
반응형

Gif.js — JavaScript GIF encoding

Gif.js is a full-featured GIF encoder built in JavaScript that runs in your browser. Images are generated in the background using web workers.

gif.js

 

Full-featured JavaScript GIF encoder that runs in your browser.

Download & Docs on GitHub

Usage

var gif = new GIF({
  workers: 2,
  quality: 10
});

// add a image element
gif.addFrame(imageElement);

// or a canvas element
gif.addFrame(canvasElement, {delay: 200});

// or copy the pixels from a canvas context
gif.addFrame(ctx, {copy: true});

gif.on('finished', function(blob) {
  window.open(URL.createObjectURL(blob));
});

gif.render();
반응형
반응형

energize.js - A tiny JavaScript snippet to make links snappy on touch devices

 

https://github.com/davidcalhoun/energize.js

 

Work in progress!

Energize is a work in progress, but it's functional. Bug reports, pull requests, etc, highlighly appreciated as always!

How do I use it?

Just include energize.js before any of your code that deals with click events (including any libraries and frameworks). The reason is that energize.js fires simulated click events and also needs to suppress the "ghost click", the real click event that is fired later. This is done via stopPropagation, which stops the the event from firing for other handlers listening for the click event. Since handlers fire in the order they were added, energize.js needs to add its own click handler first.

Why use energize?

Touch devices sometimes add an artificial delay to click events, just to make sure the user isn't double-tapping to zoom. In the case where you don't mind disabling double-tap to zoom functionality (or in cases where you've disabled viewport zooming), there's no reason to preserve the click delay. That's where energize.js comes in!

Why not just bind to ontouchend?

Because the user might touch an element in order to scroll, which results in ontouchend firing at the end of the scroll event. Do you want a click event to fire when the user was intending to scroll?

Why fire simulated click events? Why not just tie into something like Fast Button?

Because you have to add click events to EVERYTHING you want to speed up. This will mean there will be potentially be some fast UI and some slow UI on your pages. Ok, that's not so bad if you're using some form of abstraction for all click events (i.e. not using addEventListener directly).

BUT interaction with native form elements such as buttons aren't sped up unless you manually add events to them. Because of this, Energize takes the philosophy of listening for clicks bubbling up to the top and handles them appropriately so you don't have to worry about them.

 

 

반응형
반응형

React — A JavaScript UI library

React

Homepage: http://facebook.github.io/react/
GitHub: https://github.com/facebook/react
Docs: http://facebook.github.io/react/docs/getting-started.html

 

Declarative

React uses a declarative paradigm that makes it easier to reason about your application.

Efficient

React computes the minimal set of changes necessary to keep your DOM up-to-date.

Flexible

React works with the libraries and frameworks that you already know.

Getting Started

JSFiddle

The easiest way to start hacking on React is using the following JSFiddle Hello Worlds

Starter Kit

Download the starter kit to get started.

반응형
반응형

parseURI — Split any URL into logical parts

parseURI lets you split any URL into all of its parts. It has a loose mode that’s great for working with user input, and a strict mode that adheres to RFC 3986.

parseURI

 

반응형

'프로그래밍 > Web' 카테고리의 다른 글

gumby2-backbone-bootstrap  (0) 2013.06.24
Flatdoc — Simple websites for open source projects  (0) 2013.06.24
Codeblock.js— A better code learning environment  (0) 2013.06.20
PreloadJS  (0) 2013.06.20
Angular.JS 의 구조와 특징  (0) 2013.06.13
반응형

JSHint 2.0 — JavaScript error detection

JSHint 2.0 helps you detect errors and possible issues in JavaScript code. It can even be used to enforce coding conventions.

JSHint

 

반응형

+ Recent posts