Skip to content

Instantly share code, notes, and snippets.

View mikermcneil's full-sized avatar
🧑‍🚀

Mike McNeil mikermcneil

🧑‍🚀
View GitHub Profile
@mikermcneil
mikermcneil / Node.js installation on Rackspace
Created January 13, 2012 13:25
Installing nodejs, npm, and all their pals on a Rackspace Ubuntu 11.10 Server
############################################################################
# Installing nodejs, npm, and all their pals on a Rackspace Ubuntu Server
############################################################################
# First get your tools together
apt-get update
apt-get install emacs
apt-get install git
apt-get install curl
apt-get install libssl-dev
@mikermcneil
mikermcneil / gist:2037586
Created March 14, 2012 16:15
Grails: find css/js URLs and replace them with ${resource} URLs
For <script> tags:
-------------------
Find:
src="js/(\S+)">
Replace:
src="\${resource(dir:'js',file:'$1')}">
@mikermcneil
mikermcneil / async_bridge_callbacks.js
Created May 16, 2012 15:59
Asynchronous Unwired Bridge callbacks
// This example uses backbone.js to capture the hash change event.
// Unrelated functionality is referenced but not shown.
// Where ever you call it from, Unwired.login should look like the following:
/*
Unwired.login(guid, {
url: document.location.href+"#loginComplete"
});
@mikermcneil
mikermcneil / octoresponsive.js
Created May 17, 2012 19:33
Bookmarklet to make github's desktop interface responsive
javascript:function octoresponsive() {
$(".container, #slider .frames .frame, #slider .frames, .container.hentry, .avatar-bubble, html,body").css({width:'100%','minWidth':0,'paddingLeft':0}); $("#slider .frames .frame").css({'margin-right':0});
$(".columns.browser .sidebar").css({width:'20%',paddingRight:'2%'});
$(".columns.browser .main").css({width:'70%'});
}
function twitterresponsive(){
$(".wrapper, .wrapper-narrow, .wrapper-permalink").css({width:'100%',paddingLeft:0, paddingRight:0});
$(".dashboard").css({width:'30%',paddingRight:0, paddingLeft: 0});
$(".content-main").css({width:'70%',paddingRight:0,paddingLeft: 0});
@mikermcneil
mikermcneil / test-swift-cors.html
Created July 8, 2012 03:14 — forked from adrian/test-swift-cors.html
Swift CORS Javascript Example
<!DOCTYPE html>
<html>
<head>
<title>Test Swift CORS</title>
<!-- Only using jQuery for jQuery.parseJSON -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<div style="border: thin solid grey; padding-left: 10px; width: 50%; margin-left: auto; margin-right: auto">
git clone git@github.com:balderdashy/sails-example.git sails-example
cd sails-example
npm install sails
npm install rigging
cp config.ex.js config.js
# Modify config.js to map to one of your local mySQL databases with your username and password
node sails.js
# The app is configured to run on port 5008 at the moment, and you can check out:
# http://localhost:5008/experiment
@mikermcneil
mikermcneil / auto-tweepsect.js
Created September 11, 2012 19:30
Unfollow all of the people you're stalking on tweepsect.com
$("#only_following").find('ul').children().find('a').each(function(i,el){unfollow($(el).text()); })
@mikermcneil
mikermcneil / mailer.sh
Created September 11, 2012 20:08
super simple mailer script
#!/usr/bin/ksh
#———————————————————————-
# Name: SendMail
# Purpose: To send mails using the sendmail command
# Usage: SendMail
# Owner: Ketan Joshi
# Setting: Just change the variables at the start of the script to
# appropriate values. Create a message by modifying the string BODY
# You can even have html tags in the body.
# Limitation: Currently, this does not support attachments.
@mikermcneil
mikermcneil / waitUntil.js
Created October 9, 2012 21:18
waitUntil
/**
* @test - condition to check
* @action - do something
* @tryInterval - how often to try (default to 50ms)
* @sharedTimer - if sharedTimer is specified, clear it when action is fired
* @eachTime - function to run each time the condition is checked
* returns timer
*/
function waitUntil (test,action,tryInterval,sharedTimer,eachTime) {
var timer = setInterval(function() {
@mikermcneil
mikermcneil / _.recursive.js
Created October 10, 2012 03:06
Recursive versions of underscore js methods
// Recursive underscore methods
_.recursive = {
// fn(value,keyChain)
all: function(collection,fn,maxDepth) {
if (!_.isObject(collection)) {
return true;
}
// Default value for maxDepth