Skip to content

Instantly share code, notes, and snippets.

View chrismear's full-sized avatar

Chris Tucker Mear chrismear

View GitHub Profile
@mconnell
mconnell / audio_switch.applescript
Last active August 24, 2018 09:22
AppleScript for quickly flipping between 2 audio sources
-- Open automator
-- * New Service
-- * Service Recieves: no input
-- * Paste the following
-- * Alter audio sources to match your machine
-- * Save
-- Open Keyboard
-- * Shortcuts
-- * Services
-- * Bind to shortcut
@swisspol
swisspol / build.sh
Last active March 21, 2018 08:50
Tentative build script to build libjpeg-turbo for iOS devices
#!/bin/sh -ex
DEVELOPER=`xcode-select --print-path`
PLATFORM="iPhoneOS"
ARCH="armv7"
IPHONE_SDK="7.0"
IPHONE_MIN_VERSION="5.0"
VERSION="1.3.0"
NASM_VERSION="2.10.09"
@javan
javan / application_controller.rb
Created November 30, 2013 22:06
Prevent cross-origin js requests
class ApplicationController < ActionController::Base
before_filter :ensure_xhr
private
def ensure_xhr
if request.get? && request.format && (request.format.js? || request.format.json?)
head :forbidden unless request.xhr?
end
end
end
@Zettt
Zettt / OpenMeta2OSXTags.sh
Last active May 5, 2021 15:58
Script that reads OpenMeta tags and writes them to OS X Mavericks tags. http://mosx.tumblr.com/post/54049528297/convert-openmeta-to-os-x-mavericks-tags-with-this This requires a OpenMeta binary to be installed. Change its path, if you prefer it to be somewhere else. For the files to be processed properly don't include a trailing slash in `$files…
# =============================================================
# = OpenMeta to OS X Tags =
# =============================================================
# Script to convert OpenMeta tags to OS X Mavericks tags.
#
# Created by Zettt (Andreas Zeitler) on 2013-06-28
# Source www.macosxscreencasts.com, mosx.tumblr.com
#
# OpenMeta to OS X Tags by Andreas Zeitler is licensed under a
# Creative Commons Attribution-NonCommercial-ShareAlike
@neonichu
neonichu / strip-lib.sh
Created January 23, 2012 12:35
Strip debug symbol from universal static libraries (tested for iOS only)
#!/bin/sh
#
## Strip debug symbol from universal static libraries
#
if [ -z "$1" ]
then
echo "$0 library"
exit 1
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@alexmuller
alexmuller / hex_md5.js
Last active June 17, 2022 18:48
Display Gravatar when user has finished typing their email address
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
@kapowaz
kapowaz / admin.html
Created March 2, 2011 14:37
An example of what you can do with CSS 3 in webkit browsers
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Admin Home</title>
<style type="text/css">
html, body { height:100%; margin:0; padding:0; }
body
{
@jwheare
jwheare / clicolor.sh
Last active September 25, 2015 01:27
Useful shortcuts/colorisation for git
# Not really git related, this is for ls colors, put in e.g. ~/.bash_login
export CLICOLOR="true"
export LSCOLORS="DxfxexdxCxegedabagacad"
namespace :bundler do
task :create_symlink, :roles => :app do
shared_dir = File.join(shared_path, 'bundled_gems')
release_dir = File.join(current_release, 'vendor', 'bundle')
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
end
task :bundle_new_release, :roles => :app do
bundler.create_symlink
run "cd #{release_path} && bundle install --deployment"