Skip to content

Instantly share code, notes, and snippets.

View dylansm's full-sized avatar

Dylan Smith dylansm

View GitHub Profile
@dylansm
dylansm / quix.txt
Created April 11, 2010 03:25
quix.txt
pbs http://pinboard.in/search/?mine=Search+Mine&query=%s Pinboard search
pb javascript:if(document.getSelection){s=document.getSelection();}else{s='';};document.location='http://pinboard.in/add?next=same&url='+encodeURIComponent(location.href)+'&description='+encodeURIComponent(s)+'&title='+encodeURIComponent(document.title); Add Pinboard Bookmark
sw http://www.sweetwater.com/store/search.php?s=%s Sweetwater Search
read javascript:(function(){readStyle='style-newspaper';readSize='size-medium';readMargin='margin-wide';_readability_script=document.createElement('SCRIPT');_readability_script.type='text/javascript';_readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());document.getElementsByTagName('head')[0].appendChild(_readability_script);_readability_css=document.createElement('LINK');_readability_css.rel='stylesheet';_readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';_readability_css.type='text/css';_readability_css.
@dylansm
dylansm / Setting up a Git Repository.textile
Created March 28, 2011 17:10
Setting up a Git Repository

For the impatient

Set up the new bare repo on the server:

$ ssh myserver.com
Welcome to myserver.com!
$ mkdir /var/git/myapp.git && cd /var/git/myapp.git
$ git --bare init
Initialized empty Git repository in /var/git/myapp.git
$ exit
@dylansm
dylansm / instagram_fetcher.rb
Created July 28, 2011 18:19
Ruby Instagram Fetcher
require "rubygems"
require "json"
require "uri"
require "net/https"
class JSONError < StandardError; end
class InstagramFetcher
ROOT_CA = "/etc/ssl/certs"
@dylansm
dylansm / rails31init.md
Created August 3, 2011 20:33 — forked from jraines/rails31init.md
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@dylansm
dylansm / buttons.coffee
Created November 2, 2012 18:49 — forked from zeke/buttons.coffee
Haml + Coffeescript Tweet button and Like button
((d, s, id) ->
js = undefined
fjs = d.getElementsByTagName(s)[0]
return if d.getElementById(id)
js = d.createElement(s)
js.id = id
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"
fjs.parentNode.insertBefore js, fjs
) document, "script", "facebook-jssdk"
@dylansm
dylansm / resume.c
Created January 9, 2013 23:12 — forked from klange/_.md
#include <stdio.h>
#include <time.h>
/* TODO: resume.h */
typedef struct {
char * company;
char * location;
char * title;
// Useful Macros.
// The best place to import this is in your project's pch file.
// See http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ for details.
// Most current version at https://gist.github.com/325926 along with usage notes.
#ifndef jcscommonmacros
#define jcscommonmacros_1_0 10000
#define jcscommonmacros jcscommonmacros_1_0
#endif
window.renderTemplate = function(name, el, json)
{
var url = '/templates/' + name + '.html';
$.ajax({
url: url,
method: 'GET',
async: false,
dataType: 'html',
success: function(data) {
var tmpl = _.template(data);
@dylansm
dylansm / config.ru
Created August 27, 2013 17:17 — forked from stas/config.ru
require 'haml'
# Do not buffer output
$stdout.sync = true
# Get working dir, fixes issues when rackup is called outside app's dir
root_path = Dir.pwd
use Rack::Static,
:urls => ['/stylesheets', '/images', '/javascripts', '/fonts'],
:root => root_path
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1)
return NO;