Skip to content

Instantly share code, notes, and snippets.

@jasonhinkle
jasonhinkle / npm-commands.sh
Last active February 3, 2016 22:30
npm commands
# global packages are located at:
# /usr/local/lib/node_modules/
# see all installed global packages
npm ls -g
# see all outdated global packages
npm outdated -g --depth=0
# npm update all global packages
@jasonhinkle
jasonhinkle / .ssh.config
Created January 23, 2016 21:49
SSH Configuration
# Override Settings For ~/.ssh/config
# do not add localhost to known hosts (useful if you create tunnels frequently)
NoHostAuthenticationForLocalhost yes
@jasonhinkle
jasonhinkle / reset-git.txt
Created January 6, 2016 01:43
Reset Git Credentials
# clear old credentials
git credential-osxkeychain erase
host=github.com
protocol=https
<enter>
# view existing credentials
git credential-osxkeychain get
host=github.com
<enter>
@jasonhinkle
jasonhinkle / wordpress.htaccess
Last active November 24, 2015 05:57
Limit access to Wordpress admin interface to specific IP address
# LIMIT WORDPRESS ADMIN ACCESS TO A WHITELISTED IP ADDRESS
# REPLACE 255.255.255.255 WITH YOUR OWN IP
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin/.*
RewriteCond %{REQUEST_URI} !wp-admin/admin-ajax\.php$
RewriteCond %{REMOTE_ADDR} !^255.255.255.255$
RewriteRule ^(.*)$ - [R=403,L]
@jasonhinkle
jasonhinkle / sign-eclipse.sh
Created August 31, 2015 21:15
Get rid of Eclipse firewall nag
sudo codesign --force --deep --sign - /Applications/Eclipse.app/
@jasonhinkle
jasonhinkle / phantom-hotfix.md
Last active August 29, 2015 14:27
Patching PhantomJS 2.0

The PhantomJS 2.0 official binary has problems when using with Selenium. Pre-built hotpatched versions of phantomjs for OSX and Ubuntu are available at:

If you prefer to use the official binary or build from source yourself, the following errors may have to be fixed:

If phantomjs dies on OSX with message "Killed 9" then the following code will fix it.

brew install upx
upx -d /usr/local/bin/phantomjs
@jasonhinkle
jasonhinkle / ajax.js
Last active February 20, 2023 17:42
jQuery AJAX Snippet
$.ajax({
url: 'api/url',
method: 'POST',
data: {var:'val'},
// data: JSON.stringify({var:'val'}), // send data in the request body
// contentType: "application/json; charset=utf-8", // if sending in the request body
dataType: 'json'
}).done(function(data, textStatus, jqXHR) {
// because dataType is json 'data' is guaranteed to be an object
console.log('done');
@jasonhinkle
jasonhinkle / Branch Workflow.sh
Last active February 24, 2016 03:07
Branch Workflow
# INITIAL SETUP
# make sure you are working with the most recent code
git pull
# create branch & optionally add it to remote origin
git checkout -b <branchname>
git push -u origin <branchname>
# REGULAR WORKFLOW
@jasonhinkle
jasonhinkle / utils.php
Last active August 29, 2015 14:04
Imsanity custom Util.php for testing image rotation
<?php
/**
* ################################################################################
* UTILITIES - *** CUSTOM VERSION FOR TESTING ROTATION ***
* ################################################################################
*/
/**
* Util function returns an array value, if not defined then returns default instead.
* @param Array $array
/**
* View logic for Packages
*/
/**
* application logic specific to the Package listing page
*/
var page = {
packages: new model.PackageCollection(),