Skip to content

Instantly share code, notes, and snippets.

View ashchristopher's full-sized avatar

Ash Christopher ashchristopher

  • Shopify
  • Toronto, Ontario
View GitHub Profile
@stevepereira
stevepereira / gist:9466606
Created March 10, 2014 15:00
Redis install via rpm - you can pull the version out as a variable if it's stated in the role yaml
cache = Chef::Config[:file_cache_path]
rpm = redis-2.8.7-1.el6.remi.x86_64.rpm
remote_file "#{cache}/#{rpm}" do
source "http://rpms.famillecollet.com/enterprise/6/remi/x86_64/#{rpm}"
end
rname = File.basename("#{rpm}", '.*')
if `rpm -qa | grep #{rname}`.empty?
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active May 13, 2025 09:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

from django.db.models.query import QuerySet
from django.db import models
class QuerySetManager(QuerySet):
'''
Subclass this class to define custom Managers with chainable, custom
QuerySet calls.
For example, define your queryset subclassing this object:
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 28, 2025 00:02
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@polotek
polotek / ember_hurdles.md
Last active March 30, 2017 05:37
Hurdles getting started with Ember.js

This is a brain dump of my experience trying to get something going with Ember.js. My goal was to get to know the ins and outs of the framework by completing a pretty well defined task that I had lots of domain knowledge about. In this case reproducing a simple Yammer feed. As of this time, I have not been able to complete that task. So this is a subjective rundown of the things I think make it difficult to get a handle on Ember. NOTE: My comments are addressing the Ember team and giving suggestions on what they could do to improve the situation.

App setup

The new guides have pretty good explanation of the various parts of the framework; routers, models, templates, views. But it's not clear how they all get strapped together to make something that works. There are snippets of examples all over the place like:

App.Router.map(function() {
  match('/home').to('home');
});
@refractalize
refractalize / myapp.js
Created December 11, 2012 00:27
How to bootstrap AngularJS with mock dependencies, in unit tests...
// your app
myapp = angular.module('myapp', []);
myapp.directive('userView', function () {...});
myapp.factory('userApi', function () {...});
[global]
default-timeout = 60
index-url = https://simple.crate.io/
download-cache = ~/.pip/cache
log-file = ~/.pip/pip.log
TMPFILE=`mktemp /tmp/wave.XXXXXX` || exit 1
USERNAME=my_github_user_name
PASSWORD=my_password
curl -s --location -u $USERNAME:$PASSWORD https://github.com/waveaccounting/documentation/raw/master/devops/ssh_config | sed "s/USERNAME/$USERNAME/;/Identity/d" > $TMPFILE
lead='BEGIN WAVE SERVERS'
tail='END WAVE SERVERS'
sed -i.bak -e "/$lead/,/$tail/{
/$lead/ {
@codysoyland
codysoyland / gist:2505907
Created April 27, 2012 04:45
stupid gevent memcache server
from gevent.server import StreamServer
#import gevent
import time
class ClientDisconnected(Exception):
pass
class Handler(object):
def __init__(self, cache, socket, address):
self.cache = cache
// Set ``Resource.Meta.always_return_data = True`` first, then...
var relative_root = '/api/v1/';
window.HelmModel = Backbone.Model.extend({
urlRoot: relative_root,
base_url: function() {
var temp_url = Backbone.Model.prototype.url.call(this);
return (temp_url.charAt(temp_url.length - 1) == '/' ? temp_url : temp_url+'/');