Skip to content

Instantly share code, notes, and snippets.

@patocallaghan
patocallaghan / scroller.js
Created August 24, 2012 03:02
jQuery scrolling animation #js #javascript #jquery #scroll
$( 'html,body' ).animate( { scrollTop: $( id ).position().top }, 500, 'easeInOutExpo' );
@patocallaghan
patocallaghan / swfload.js
Created September 17, 2012 22:21
Check if some object exists before we load it e.g. swfobject (use typeof so it works in oldIE) #js #swfobject #ie8
(function swfEmbed() {
if ( typeof swfobject === 'undefined' ) {
setTimeout( function () { swfEmbed(); }, 100 );
} else {
var vars = { xmlPath: '/RotatorXml', linkCol: '#ffffff' };
var params = {};
var attributes = {};
swfobject.embedSWF( "/flash/HomepageRotator.swf", "rotator-homepage-flash", "796", "428", "9.0.0", "/flash/expressInstall.swf", vars, params, attributes );
}
} )();
@patocallaghan
patocallaghan / grunt-init-templates.bat
Last active December 16, 2015 13:18
Grunt-init templates: Commands to install grunt-init and grunt templates onto a Windows machine.
git clone https://github.com/gruntjs/grunt-init-jquery.git %USERPROFILE%/.grunt-init/jquery
git clone https://github.com/gruntjs/grunt-init-gruntfile.git %USERPROFILE%/.grunt-init/gruntfile
git clone https://github.com/gruntjs/grunt-init-gruntplugin.git %USERPROFILE%/.grunt-init/gruntplugin
git clone https://github.com/gruntjs/grunt-init-node.git %USERPROFILE%/.grunt-init/node
git clone https://github.com/gruntjs/grunt-init-commonjs.git %USERPROFILE%/.grunt-init/commonjs
npm install -g grunt-init
@patocallaghan
patocallaghan / docpad-debug-docpad-plugin
Created May 22, 2013 09:06
docpad-plugin-partials debug log
debug: Plugins loading for: C:\dev\inuit.css-kitchensink\node_modules
→ [2013-05-22 20:54:43.362] [C:\Users\jaimefox\AppData\Roaming\npm\node_modules\docpad\out\lib\docpad.js] [DocPad.log]
debug: Loading plugin: eco
→ [2013-05-22 20:54:43.389] [C:\Users\jaimefox\AppData\Roaming\npm\node_modules\docpad\out\lib\docpad.js] [DocPad.log]
debug: Loading plugin: livereload
→ [2013-05-22 20:54:43.401] [C:\Users\jaimefox\AppData\Roaming\npm\node_modules\docpad\out\lib\docpad.js] [DocPad.log]
debug: Loading plugin: marked
→ [2013-05-22 20:54:43.411] [C:\Users\jaimefox\AppData\Roaming\npm\node_modules\docpad\out\lib\docpad.js] [DocPad.log]
debug: Loading plugin: partials
→ [2013-05-22 20:54:43.421] [C:\Users\jaimefox\AppData\Roaming\npm\node_modules\docpad\out\lib\docpad.js] [DocPad.log]
netstat -a -n -o
TaskKill.exe /PID <value>
@patocallaghan
patocallaghan / useful-vim-commands
Last active September 19, 2023 10:10
A collection of useful VIM commands I always have trouble remembering..
#Check system version information
:version
#Check what plugins are installed
:scriptnames
#Open .vimrc
<leader> + e,v
#Reload .vimrc
@patocallaghan
patocallaghan / docpad-run.bat
Created July 27, 2013 10:57
Run docpad locally
node ./node_modules/docpad/bin/docpad run
@patocallaghan
patocallaghan / chai-expect.md
Last active September 14, 2023 14:54
Chai Expect Assertion library examples. From http://chaijs.com/api/bdd/ #chai #javascript #expect

##Chai Expect

##Language Chains

  • to
  • be
  • been
  • is
  • that
  • and
  • have
@patocallaghan
patocallaghan / chai-jquery-expect.md
Last active December 20, 2015 15:29
Chai jQuery plugin examples. Uses `expect` style. Examples from http://chaijs.com/plugins/chai-jquery. #sinon #chai #javascript #jquery

#Chai jQuery

##.attr(name[, value])

expect($('body')).to.have.attr('foo', 'bar');
expect($('body')).to.have.attr('foo').match(/bar/);

##.css(name[, value])