Skip to content

Instantly share code, notes, and snippets.

View mkelley33's full-sized avatar
🎯
Focusing

Michaux Kelley mkelley33

🎯
Focusing
View GitHub Profile
@dfeeney
dfeeney / settings.py
Created March 28, 2011 03:30
Working django-cms settings with django 1.3 staticfiles
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@kodi
kodi / gist:897382
Created March 31, 2011 22:20
javascript & jquery multiple event listeners
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#button').click(function() {
FOO.trigger('buttonPushed', {bar:32});
@dodecaphonic
dodecaphonic / gist:946254
Created April 28, 2011 12:29
Function set sequences to max in Postgres (instead of writing the same piece of code in ruby again and again)
Taken from http://stackoverflow.com/questions/244243/how-to-reset-postgres-primary-key-sequence-when-it-falls-out-of-sync.
--drop function IF EXISTS reset_sequence (text,text) RESTRICT;
CREATE OR REPLACE FUNCTION "reset_sequence" (tablename text,columnname text) RETURNS bigint --"pg_catalog"."void"
AS
$body$
DECLARE seqname character varying;
c integer;
BEGIN
select tablename || '_' || columnname || '_seq' into seqname;

SciPy, PyQt and Matplotlib on OS X Snow Leopard

The squeeky-clean way with homebrew and pip/virtualenv.

$ easy_install pip
$ pip install virtualenvwrapper mercurial
$ brew install gfortran && brew install pyqt
# Have a nice long coffee break -- compiling Qt took 67 minutes on my

quad-core i7 MBP, PyQt another 8.

@nuc
nuc / progress_with_names.rb
Created November 16, 2011 17:39 — forked from natritmeyer/progress_with_names.rb
An rspec formatter that prints each test name and result to the console on a new line - hudson likes it
require "rspec/core/formatters/base_text_formatter"
class ProgressWithNames < RSpec::Core::Formatters::BaseTextFormatter
def example_passed(example)
super(example)
output.print green(".")
end
def example_pending(example)
super(example)
@mkelley33
mkelley33 / copy_my_computer_ip.sh
Created June 15, 2012 02:28
Copy computer's IP address to clipboard
# When testing a rails website on my local development machine, I found my
# Parallel's VM wouldn't load 0.0.0.0:3000, 127.0.0.1, or localhost:3000.
#
# So I tried using my computers IP address and voila. I thought I'd hone
# my bash chops a little and extract the IP address with the port number
# concatenated to it. This command puts that on the clipboard so I can just
# paste it into IE so I could browser test.
#
# NOTE: the pbcopy command is Mac specific.
#
@kenergy
kenergy / gist:3949394
Created October 24, 2012 22:37
OSX for Hackers: Mountain Lion Edition
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "MacBookPro"
scutil --set HostName "MacBookPro"
scutil --set LocalHostName "MacBookPro"
@daviddavis
daviddavis / ktest
Last active December 27, 2015 16:49
Script for running individual Katello::Engine tests
#!/usr/bin/env bash
if [[ -n $1 ]]
then
RAKE_PATH=`bundle show rake`
ruby -I"lib:test:${KATELLO_PATH}/test:${KATELLO_PATH}/spec" -I"${RAKE_PATH}/lib" \
"${RAKE_PATH}/lib/rake/rake_test_loader.rb" $@ ${KATELLO_PATH}/test/katello_test_runner.rb
else
bundle exec rake test:katello
fi
@mislav
mislav / tmux-switch-session.sh
Created January 13, 2013 17:26
A jump-to-session tmux shortcut. With `<prefix> S` a prompt is shown to enter a session name. If no name is given, switches back to the previously attached session. Session name can be a partial string that the session starts with, as long as it's unique.
#!/usr/bin/env bash
set -e
if [[ -z $1 ]]; then
tmux switch-client -l
else
tmux switch-client -t "$1"
fi
@timruffles
timruffles / hash_converter.rb
Created May 24, 2012 09:47
rails hash formatter - hash/json to/from camel case and underscores
module HashConverter
class << self
def to_underscore hash
convert hash, :underscore
end
def to_camel_case hash
convert hash, :camelize, :lower
end
def convert obj, *method
case obj