Skip to content

Instantly share code, notes, and snippets.

View dylansm's full-sized avatar

Dylan Smith dylansm

View GitHub Profile
@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;
require 'rubygems'
require 'bundler'
Bundler.require
require './application'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] do
end
server {
listen 80;
server_name trials.dailyemerald.com;
access_log /srv/www/trials.dailyemerald.com/access.log;
gzip on;
location / {
root /srv/www/trials.dailyemerald.com/public_html;
try_files $uri /index.html;
}