As easy as 1, 2, 3!
Updated:
- Aug, 08, 2022 update
configdocs for npm 8+ - Jul 27, 2021 add private scopes
- Jul 22, 2021 add dist tags
- Jun 20, 2021 update for
--access=public - Sep 07, 2020 update docs for
npm version
| # If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer! | |
| export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ " | |
| # This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty! | |
| # ~/code/web:beta_directory$ git checkout master | |
| # Switched to branch "master" | |
| # ~/code/web:master$ git checkout beta_directory | |
| # Switched to branch "beta_directory" |
| // http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands | |
| Raphael.fn.arc = function(startX, startY, endX, endY, radius1, radius2, angle) { | |
| var arcSVG = [radius1, radius2, angle, 0, 1, endX, endY].join(' '); | |
| return this.path('M'+startX+' '+startY + " a " + arcSVG); | |
| }; | |
| Raphael.fn.circularArc = function(centerX, centerY, radius, startAngle, endAngle) { | |
| var startX = centerX+radius*Math.cos(startAngle*Math.PI/180); | |
| var startY = centerY+radius*Math.sin(startAngle*Math.PI/180); | |
| var endX = centerX+radius*Math.cos(endAngle*Math.PI/180); |
| /* | |
| * jQuery.ajaxQueue - A queue for ajax requests | |
| * | |
| * (c) 2011 Corey Frang | |
| * Dual licensed under the MIT and GPL licenses. | |
| * | |
| * Requires jQuery 1.5+ | |
| */ | |
| (function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery) |
| /* | |
| A (very) WIP collection of optimized/recommended jQuery plugin patterns | |
| from @addyosmani, @cowboy, @ajpiano and others. | |
| Disclaimer: | |
| ----------------------- | |
| Whilst the end-goal of this gist is to provide a list of recommended patterns, this | |
| is still very much a work-in-progress. I am not advocating the use of anything here | |
| until we've had sufficient time to tweak and weed out what the most useful patterns |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| <snippet> | |
| <!-- put this file in /packages/User/<Folder Name>/console_log.sublime-snippet then restart your Sublime Text 2 --> | |
| <content><![CDATA[console.log($1);$0]]></content> | |
| <tabTrigger>conl</tabTrigger> | |
| <scope>text.html,source.js</scope> | |
| <description>console.log()</description> | |
| </snippet> | |
| <snippet> | |
| <!-- put this in another file /packages/User/<Folder Name>/console_dir.sublime-snippet then restart your Sublime Text 2 --> |
| #!/bin/bash | |
| ## | |
| # Script created by David Lewis ([email protected]) for PyroCMS | |
| # This script will rename an existing (core) CMS module and duplicate it into the | |
| # addons/shared_addons/modules directory, while renaming it and all file contents to | |
| # match | |
| # | |
| # Usage: ./rename_module.sh "old_module" "new_module" | |
| # |
| var stringify = function(obj, prop) { | |
| var placeholder = '____PLACEHOLDER____'; | |
| var fns = []; | |
| var json = JSON.stringify(obj, function(key, value) { | |
| if (typeof value === 'function') { | |
| fns.push(value); | |
| return placeholder; | |
| } | |
| return value; | |
| }, 2); |