Skip to content

Instantly share code, notes, and snippets.

View itspriddle's full-sized avatar
🤘
clickity clack

Joshua Priddle itspriddle

🤘
clickity clack
View GitHub Profile
Sure, you can ogle her <BODY> - stare at her <FORM>, but for crying out loud, use your <HEAD>!
<A> woman doesn't want to be treated as an <OBJECT>. You've got to have <STYLE>. Work on
your pickup lines, don't read from some <SCRIPT>. Be <BOLD>, and take chances! Make sure
each <BUTTON> on your shirt is done up right. <SELECT> a nice cologne, but not too much!
Follow these simple instructions, stay in the right <FRAME> of mind, and <I> am sure
you'll soon be a <LEGEND> in dating.
@tomlea
tomlea / proxy.rb
Created October 11, 2009 21:11
Rack Middleware to proxy requests to a remote server. This is usefull for proxying AJAX request to remote services.
require "net/http"
require "enumerator"
# Example Usage:
#
# use Rack::Proxy do |req|
# if req.path =~ %r{^/remote/service.php$}
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}")
# end
# end
@westonruter
westonruter / canPlayAudioMP3.js
Created December 10, 2009 07:13
HTML5 MP3 Audio detection
/**
* Detect if the browser can play MP3 audio using native HTML5 Audio.
* Invokes the callack function with first parameter is the boolean success
* value; if that value is false, a second error parameter is passed. This error
* is either HTMLMediaError or some other DOMException or Error object.
* Note the callback is likely to be invoked asynchronously!
* @param {function(boolean, Object|undefined)} callback
*/
function canPlayAudioMP3(callback){
try {
@bru
bru / newpost.rb
Created December 25, 2009 16:33 — forked from jrk/newpost.rb
Creates a new Jekyll post, opens it in TextMate, and adds to the git index
#!/usr/bin/env ruby
require Dir
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
blog_root = "/Users/jrk/proj/blog"
@stephencelis
stephencelis / minifacture.rb
Last active September 17, 2016 18:33
factory_girl for minitest
# factory_girl for minitest
#
# Factory.define :user do |f|
# f.login 'johndoe%d' # Sequence.
# f.email '%{login}@example.com' # Interpolate.
# f.password f.password_confirmation('foobar') # Chain.
# end
#
# Factory.define :post do |f|
# f.user { Factory :user } # Blocks, if you must.
# Convert dec => hex and hex => dec
def decimal_to_hex(number)
res = number.to_i.to_s(16)
res = "0" * (12 - res.length) << res if res.length < 12
res
end
def hex_to_decimal(number)
"0x#{number}".hex
# Add the below to /etc/sudoers (use visudo as root)
# to allow `sudo apachectl [action]` without
# the need for a password
# Cmnd alias specification
Cmnd_Alias APACHECTL = /usr/sbin/apachectl
# User privilege specification
%admin ALL=NOPASSWD: APACHECTL
/path/to/rails_apps/*/log/*.log {
daily
missingok
rotate 30
compress
delaycompress
sharedscripts
postrotate
find /path/to/rails_apps/* -name tmp -maxdepth 1 -type d -exec touch {}/restart.txt \;
endscript
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.
@shapeshed
shapeshed / twit_twurl.sh
Created June 4, 2010 12:21
Tweet from the command line using twurl & OAuth
################################
#!/usr/bin/env bash
# File: twit_twurl.sh
# Description: Tweet from the command line using twurl & OAuth
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at