npm initthis will create apackage.jsonnpm install gulp --save-devinstalls gulp locally- Add more modules
npm install <MODULE> --save-dev - Create a task:
gulp.task('task-name', function() {
// Stuff here
});- Run the task with
gulp task-name
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| var Artist = Backbone.Model.extend(); | |
| var Artists = Backbone.Collection.extend({ | |
| model : Artist, | |
| url : "http://api.discogs.com/database/search?type=artist", | |
| sync : function(method, collection, options) { | |
| // By setting the dataType to "jsonp", jQuery creates a function | |
| // and adds it as a callback parameter to the request, e.g.: | |
| // [url]&callback=jQuery19104472605645155031_1373700330157&q=bananarama | |
| // If you want another name for the callback, also specify the |
| /* | |
| * using curl | |
| */ | |
| $key = 'YOUR_KEY_HERE'; | |
| $secret = 'YOUR_SECRET_HERE'; | |
| $api_endpoint = 'https://api.twitter.com/1.1/users/show.json?screen_name=marcosfernandez'; // endpoint must support "Application-only authentication" | |
| // request token | |
| $basic_credentials = base64_encode($key.':'.$secret); |
| var R = require("request"); | |
| var key = process.env.TWITTER_CONSUMER_KEY; | |
| var secret = process.env.TWITTER_CONSUMER_SECRET; | |
| var cat = key +":"+secret; | |
| var credentials = new Buffer(cat).toString('base64'); | |
| var url = 'https://api.twitter.com/oauth2/token'; | |
| R({ url: url, |
| var request = require('request'); | |
| var consumer_key = 'YOUR_CONSUMER_KEY'; | |
| var consumer_secret = 'YOUR_CONSUMER_SECRET'; | |
| var enc_secret = new Buffer(consumer_key + ':' + consumer_secret).toString('base64'); | |
| var oauthOptions = { | |
| url: 'https://api.twitter.com/oauth2/token', | |
| headers: {'Authorization': 'Basic ' + enc_secret, 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}, | |
| body: 'grant_type=client_credentials' | |
| }; |
npm init this will create a package.jsonnpm install gulp --save-dev installs gulp locallynpm install <MODULE> --save-devgulp.task('task-name', function() {
// Stuff here
});gulp task-name| CustomInfoWindow.prototype.panMap = function(marker, map) { | |
| var offsetX = 100 | |
| var offsetY = 75 | |
| var scale = Math.pow(2,map.getZoom()) | |
| var center = map.getProjection().fromLatLngToPoint(marker.getPosition()) | |
| var newCenterPoint = new google.maps.Point( | |
| center.x - offsetX/scale, | |
| center.y + offsetY/scale | |
| ) | |
PYTHON_PATH and add C:\Python27PATH environment variable, add %PYTHON_PATH% and %PYTHON_PATH%\ScriptsPYTHON_PATH if you change versionsez_setup.pynpm install -g jsdocjsdoc path/to/file.jsSource: http://stackoverflow.com/questions/33948829/how-do-i-use-jsdoc-on-windows
| function go() { | |
| var userId = prompt('Username?', 'Guest'); | |
| checkIfUserExists(userId); | |
| } | |
| var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users'; | |
| function userExistsCallback(userId, exists) { | |
| if (exists) { | |
| alert('user ' + userId + ' exists!'); |