Skip to content

Instantly share code, notes, and snippets.

" .vimrc File
" Procured from: Jeffrey Way
" jeffrey@jeffrey-way.com
"
" Improved by: Garrett Dawson
" killtheliterate@gmail.com
"
"Forget compatibility with Vi. Who cares.
set nocompatible
@yortz
yortz / gist:3314799
Created August 10, 2012 15:01
StoreLocator
class mm.StoreLocator extends mm.Module
constructor: ->
@canvas = $('#map-canvas')
@center = new google.maps.LatLng(51.512054, -0.103855)
@mapOpts =
zoom: 11
zoomControl: true #seems that 320-up is breaking zoomcontrol???? though it seems from the mockups that they just want an empy map
disableDefaultUI: true
mapTypeId: google.maps.MapTypeId.ROADMAP
center: @center
@yortz
yortz / gist:1394699
Created November 25, 2011 23:51 — forked from metaskills/gist:756111
Rails 3 Models To Export Mephisto To Jekyll & Disqus
require 'builder'
require 'digest/md5'
class Content < ActiveRecord::Base
belongs_to :user
end
class Section < ActiveRecord::Base
has_many :assigned_sections
has_many :articles, :order => 'position', :through => :assigned_sections
@yortz
yortz / resize_and_crop.rb
Created August 13, 2011 22:14 — forked from soutaro/resize_and_crop.rb
resize and crop using using MiniMagick
def resize_and_crop(blob, w0, h0, w1, h1)
image = MiniMagick::Image.read(blob)
rw = w1.to_f / w0
rh = h1.to_f / h0
unless rw > 1 or rh > 1
w,h = w1, h1
sx, sy = 0, 0
@yortz
yortz / test_server.rb
Created August 13, 2011 15:21 — forked from vincentchu/test_server.rb
Test sinatra + EventMachine
require 'rubygems'
require 'sinatra/base'
require 'eventmachine'
require 'logger'
$logger = Logger.new(File.join(File.dirname(__FILE__), "development.log"))
module TestEM
def self.start
if defined?(PhusionPassenger)
@yortz
yortz / gist:1140103
Created August 11, 2011 16:32 — forked from rweald/gist:969981
Multi-threaded Non blocking file uploads using EventMachine and EM-Http-Request
#!/usr/bin/env ruby
require 'em-http-request'
require 'fiber'
require "ruby-debug"
class AsynUploader
@successes = []
@failures = []
@yortz
yortz / gist:1128473
Created August 5, 2011 20:43 — forked from crosebrugh/gist:1128448
Using nested_for_for with rails_admin
class Product < ActiveRecord::Base
has_many :material_product_mappings, :dependent => :destroy, :inverse_of => :product
has_many :materials, :through => :material_product_mappings, :autosave => true
#...
rails_admin do
list do
field :material_product_mappings do
@yortz
yortz / post-receive
Created June 26, 2011 00:28 — forked from carlosantoniodasilva/post-receive
Basic git post-receive hook file to deploy a Rails app.
#!/bin/bash
APP_NAME="your-app-name-goes-here"
APP_PATH=/home/deploy/${APP_NAME}
# Production environment
export RAILS_ENV="production"
# This loads RVM into a shell session. Uncomment if you're using RVM system wide.
# [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm"
@yortz
yortz / LICENSE.txt
Created May 18, 2011 14:31 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
Copyright (c) 2011 YOUR_NAME_HERE, YOUR_URL_HERE
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
#
# node ---------------> ~/.nvm/<node-version>/bin/node
# node-libraries -----> ~/.node_libraries
# node-binaries ------> ~/.node_binaries
#
aptitude install g++ curl libssl-dev apache2-utils make
git clone git://github.com/creationix/nvm.git ~/.nvm
vi ~/.bashrc
NVM_DIR=$HOME/.nvm
. $NVM_DIR/nvm.sh