Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Coding!

Andrew Crookston acrookston

👨‍💻
Coding!
Block or report user

Report or block acrookston

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ie-box-shadow.css
.box-shadow {
width: 100px;
height: 100px;
position: absolute;
z-index: 100;
top: 10;
left: 10;
background: #fff;
-moz-box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.8); /* FF3.5+ */
-webkit-box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.8); /* Saf3.0+, Chrome */
View gist:1180414
SELECT
node.nid AS nid,
node_data_field_spot_permalink.field_spot_permalink_value AS node_data_field_spot_permalink_field_spot_permalink_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_spot_permalink.field_spot_image_fid AS node_data_field_spot_permalink_field_spot_image_fid,
node_data_field_spot_permalink.field_spot_image_list AS node_data_field_spot_permalink_field_spot_image_list,
node_data_field_spot_permalink.field_spot_image_data AS node_data_field_spot_permalink_field_spot_image_data,
node.title AS node_title,
node_data_field_spot_permalink.field_spot_bloggname_value AS node_data_field_spot_permalink_field_spot_bloggname_value,
View gist:1194290
# Directory listing
alias ls="ls -G"
alias l="ls"
alias ll='ls -Ghlk'
alias la='ls -GAhlka'
alias ..="cd .."
alias G=" | grep "
# Convenience commands
alias flushdns="dscacheutil -flushcache"
View gist:1446888
// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
log.history = log.history || []; // store logs to an array for reference
log.history.push(arguments);
if(this.console){
console.log( Array.prototype.slice.call(arguments) );
}
};
View gist:1981887
def redirect_mobile(url = "http://detectmobilebrowser.com/mobile")
redirect_to url if /android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.match(request.user_agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|j
@acrookston
acrookston / scroll.js
Created May 16, 2012
Small scrolling script for fun. Not sure how well it works. Please contribute if you have ideas.
View scroll.js
Scrolling = {};
$.extend(Scrolling, {
smoothScrollTo: function(top) {
var sm_speed = 300;
var sm_runs = 0;
var sm_last = -1; // don't use 0, b/c sm_window_top can be 0
var sm_window_top = $(window).scrollTop();
var sm_down = (top > sm_window_top);
var sm_each_step = (sm_down ? top - sm_window_top : sm_window_top - top) / (sm_speed / 13);
var sm_scroll = function() {
@acrookston
acrookston / scroll.js
Created May 17, 2012 — forked from arnorhs/scroll.js
Small scrolling script for fun. Not sure how well it works. Please contribute if you have ideas.
View scroll.js
// muhaha.. changed all the code
// maybe this version handles scrolling to the bottom edge of a document a little better
// still not satisfied with the speed variable.. should that be higher == more speed, perhaps? or pixels per second?
// sorry about the opinionated style changes
Scrolling = {
smoothScrollTo: function(target_top) {
// ensure that we never scroll further than viewport size from bottom of the doc
target_top = Math.min(target_top, Math.max($(document).height(), $(window).height()) - $(window).height());
var speed = 30,
View pngbai-git.sh
#!/bin/bash
git diff --name-only origin/master | grep '\.png$' | xargs -I xxx -P 10 -t pngbai xxx xxx2
echo "Replacing files"
find . -iname *.png2 -exec bash -c 'echo {} `dirname {}`/`basename {} .png2`.png' \;
find . -iname *.png2 -exec bash -c 'mv {} `dirname {}`/`basename {} .png2`.png' \;
echo "Removing leftovers"
find . -iname *.png2.png -exec bash -c 'echo {}' \;
View ruby-warrior.rb
class Player
def od(dir)
return dir == :backward ? :forward : :backward
end
def play_turn(warrior)
w = warrior
@direction = :forward if @direction == nil
@back = 0 if @back == nil
@rest = false if @rest == nil
@acrookston
acrookston / growth-hacking.md
Created Aug 27, 2013
Summary of The Definitive Guide to Growth Hacking
View growth-hacking.md
You can’t perform that action at this time.