Skip to content

Instantly share code, notes, and snippets.

View adambutler's full-sized avatar

Adam Butler adambutler

View GitHub Profile
@adambutler
adambutler / generate_uid.rb
Created May 20, 2015 10:15
Generate a UID
def generate_uid
self.uid = loop do
uid = SecureRandom.urlsafe_base64(nil, false)
break uid unless Model.exists?(uid: uid)
end
end
@adambutler
adambutler / cap.md
Last active August 29, 2015 14:17
Capistrano Errors Troubleshooting

Capistrano errors troubleshooting

SSHKit::Runner::ExecuteError: [...] bundle exit status: 5

Capistrano runs bundler with --quiet by default, this can cause bundler issues to not bubble back up to capistrano. You can fix this by adding this in your deploy.rb file -

set :bundle_flags, "--deployment"
@adambutler
adambutler / gist:399b0cc481c0dfebb435
Created November 6, 2014 13:10
Handbreak - Fix iPhone Video

HandBrakeCLI -i ./src.mp4 -o ./out.mp4 --rotate=4 --crop 0:0:424:424

@adambutler
adambutler / regex.md
Created October 13, 2014 09:17
Regex to convert a normal css url to a rusic liquid css url

Find

url\('(.*?)'\)

Replace

url(#{"{{ '$1' | image_url }}"})

@adambutler
adambutler / diy.js
Created September 26, 2014 13:28
diy.js
$ = document
@adambutler
adambutler / cordovaParse.md
Last active August 29, 2015 14:04
Cordova Push-notifications with Parse

Parse

  1. Create an application
  2. Goto Data Browser
  3. Create a new class, select installation
  4. Add a new column call it Id

Apple Developer

  1. Create a certificate and provisioning profile for push
@adambutler
adambutler / README.md
Last active August 29, 2015 14:04
WP-Engine mount SFTP for automation yo!
brew install osxfuse
If upgrading from a previous version of osxfuse, the previous kernel extension
will need to be unloaded before installing the new version. First, check that
no FUSE-based file systems are running:

  mount -t osxfusefs
@adambutler
adambutler / php54-mongo-1.4.5.sh
Last active August 29, 2015 14:02
php54-mongo version 1.4.5
#!/bin/sh
# Usage:
# curl https://gist.githubusercontent.com/adambutler/25dbc9b0fb4171f985fa/raw/4044a30e73a0cac5270d88d74e2a60062a5ce878/php54-mongo-1.4.5.sh | sh
brew uninstall php54-mongo
wget http://cl.ly/3e4324332D1C/1.4.5.zip
tar xfz 1.4.5.zip
mkdir -p /usr/local/Cellar/php54-mongo/
mv 1.4.5 /usr/local/Cellar/php54-mongo/1.4.5
brew link php54-mongo
@adambutler
adambutler / run.sh
Last active August 29, 2015 14:01
Install Wordpress with the command line
#!/bin/sh
wget http://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
rsync -r --ignore-existing ./wordpress/ ./
rm -R ./wordpress ./latest.tar.gz
@adambutler
adambutler / _bookmarklet.md
Last active August 29, 2015 14:01
Gremlins Bookmarklet

Gremlins Bookmarklet

An simple bookmarklet to create a horde or gremlins and unleash them on any website. See gremlins.js by marmelab for more information.

Edit a bookmarklet and set the URL to be -

javascript:(function()%7Bvar%20ScriptLoader%2CscriptLoader%3BScriptLoader%3Dfunction()%7Bfunction%20a()%7B%7Dreturn%20a.prototype.setupCallback%3Dfunction(a%2Cb)%7Breturn%20a.readyState%3Fa.onreadystatechange%3Dfunction()%7Breturn%22loaded%22%3D%3D%3Da.readyState%7C%7C%22complete%22%3D%3D%3Da.readyState%3Fb()%3Avoid%200%7D%3Aa.onload%3Dfunction()%7Breturn%20b()%7D%7D%2Ca.prototype.createScript%3Dfunction(a)%7Bvar%20b%3Breturn%20b%3Ddocument.createElement(%22script%22)%2Cb.type%3D%22text%2Fjavascript%22%2Cb.charset%3D%22UTF-8%22%2Cb.src%3Da%2Cb%7D%2Ca.prototype.add%3Dfunction(a%2Cb)%7Bvar%20c%3Breturn%20c%3Dthis.createScript(a)%2Cdocument.body.appendChild(c)%2Cnull!%3Db%3Fthis.setupCallback(c%2Cb)%3Avoid%200%7D%2Ca%7D()%2CscriptLoad