- UglifUI: http://alexsexton.com/uglifui/
- cssmin: http://tools.w3clubs.com/cssmin/ (post)
- Smush.it: http://www.smushit.com/ysmush.it/
- Spritecow: http://www.spritecow.com/
| // <script type="text/someunknowntype" id="logo-svg"><svg>...</svg></script> | |
| var svg = $('#logo-svg')[0].innerHTML | |
| // >< whitespace cleanr >< | |
| .replace(/>[\s]+</g, '><') | |
| .replace(/[\s]+/g, ' ') | |
| // get an array of path hash object, with path/attr property | |
| .match(/<(path[^\/]+)\/>/g) | |
| .map(function(el) { | |
| var m = el.match(/<path d="([^"]+).+style="([^"]+).+/), | |
| attr = {}, |
| function tmpl(s,d){return s.replace(/:([a-z]+)/g, function(w,m){return d[m];});} | |
| // auto executing function | |
| function tmpl(s,d){return s.replace(/:([a-z]+)/g, function(w,m){return w.replace(/.+/, d[m]);});} | |
| /* | |
| tmpl(':foo <p>:bar</p>', {foo: 'bar', bar: true}) | |
| > bar <p>true</p> |
| // callback style | |
| findgit(Path.join(dir, 'templates'), function(err, r) { | |
| console.log('test findgit', r.files.length); | |
| }); | |
| // event emitter style | |
| findgit(Path.join(dir, 'templates')) | |
| .on('error', function(e){ console.log('Doooooh, there was an error', e); }) | |
| .on('file', function(file){ console.log('A file: ', file); }) | |
| .on('directory', function(dir){ console.log('A dir: ', dir); }) |
| var spawn = require('child_process').spawn, | |
| un = spawn('git', ['config', 'user.name', 'Batman']), | |
| ue = spawn('git', ['config', 'user.email', '[email protected]']), | |
| g = spawn('git', ['commit', '-am', "Jooooooker"]); | |
| un.stdout.on('data', function (data) { | |
| console.log('un stdout: ' + data); | |
| }); | |
| ue.stdout.on('data', function (data) { |
| /** | |
| * http://javascript.crockford.com/code.html | |
| * http://yuiblog.com/assets/crockford/theory.zip | |
| */ | |
| function walker(texas, ranger) { | |
| ranger(texas); | |
| texas = texas.firstChild; | |
| while (texas) { | |
| walker(texas, ranger); |
| /* | |
| * Script for albumtable.html template | |
| */ | |
| $(document).ready(function() { | |
| $("#voteInfo").hide(); | |
| $('#albumList').dataTable(); | |
| //album covers | |
| $.each($('.cover'), function(){ | |
| var album = $(this).parent().parent().attr("id"); | |
| //album id |
| // inspired by, based on http://alexsexton.com/?p=51 | |
| (function($, global) { | |
| // Make sure Object.create is available in the browser (for our prototypal inheritance) | |
| (function() { | |
| if(typeof Object.create === 'function') { | |
| return; | |
| } |
View the source of this content.
Let's get the whole "linebreak" thing out of the way. The next paragraph contains two phrases separated by a single newline character:
Roses are red Violets are blue