Skip to content

Instantly share code, notes, and snippets.

@rharjes
rharjes / FbConsole.rb
Created June 8, 2011 18:40
Simplified Facebook interactions/navigation via Ruby/Mechanize.
#####################################################################
# Simplified Facebook interactions/navigation via Ruby/Mechanize. #
# Author: Robbie Harjes #
# Date: 6/8/2011 #
# Notes: Not liable for misuse; free for non-commercial projects.#
# This notice must remain intact if you use this code. #
#####################################################################
@mxriverlynn
mxriverlynn / 1-model-workaround.rb
Created June 13, 2011 20:47
Code For: Partially Solving The Date Parsing Defficiency Of Rails 3 And Mongoid
class SomeModel
include Mongoid::Document
field :date, :type => Date
validates_presence_of :date
def date=(value)
begin
date_parsed = value.to_date
write_attribute :date, date_parsed
@durran
durran / simple_form.rb
Created September 16, 2011 11:25
Mongoid with simple form.
module SimpleForm
class FormBuilder
alias _find_association_reflectio find_association_reflection
def find_association_reflection(association) #:nodoc:
if reflection = _find_association_reflectio(association)
ActiveModelMetadataProxy.new reflection
end
end
@miletbaker
miletbaker / map_tile.rb
Created October 9, 2011 19:11
Ruby script to scale and crop an image into overlay or map tiles for use with Google Maps API, Javascript for display custom map tiles below.
#! /usr/bin/ruby -w
require 'rubygems'
require 'rmagick'
require 'fileutils'
include Magick
ARGV.each do |file|
puts "Processing #{file}"
@lagartoflojo
lagartoflojo / nesting.coffee
Created February 13, 2012 23:12 — forked from geddski/nesting.js
Helper function for nesting Backbone collections (CoffeeScript version)
Backbone.Model::nestCollection = (attributeName, nestedCollection) ->
#setup nested references
for item, i in nestedCollection
@attributes[attributeName][i] = nestedCollection.at(i).attributes
#create empty arrays if none
nestedCollection.bind 'add', (initiative) =>
if !@get(attributeName)
@attributes[attributeName] = []
@get(attributeName).push(initiative.attributes)
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@scottatron
scottatron / nginx_unicorn.erb
Created September 16, 2012 05:20
Rails / Dragonfly / nginx X-Sendfile (aka X-Accel-Redirect)
upstream unicorn {
server unix:/tmp/unicorn.<%= application %>.sock fail_timeout=0;
}
server {
listen 80 default deferred;
# server_name example.com;
root <%= current_path %>/public;
if (-f $document_root/system/maintenance.html) {
@gertig
gertig / gist:6038283
Last active December 19, 2015 23:59 — forked from arkan/gist:5662905
class MyCustomCell < UITableViewCell
# This method is used by ProMotion to instantiate cells.
def initWithStyle(style_name, reuseIdentifier: reuseIdentifier)
super
stylish
self
end
# A delegate method when the user clicks the Row(it's blue by default)
@dommmel
dommmel / Vagrantfile
Last active March 6, 2023 04:19
Vagrantfile for Ruby on Rails application development (rbenv, postgres, node.js)
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
set -e
set -x
cd
sudo apt-get update -y
sudo apt-get install \
@hallahan
hallahan / installation.md
Last active February 14, 2017 13:00
SpatialServer Installation Instructions

Preliminary Packages

Make sure you have done sudo apt-get update and sudo apt-get upgrade on your fresh install. This guide is geared toward Ubuntu 14.04 LTS (Trusty Tahr). Most of the guide will work for earlier versions of Ubuntu with some slight changes, but 14.04 is advised.

Enable the root user

sudo cp /home/ubuntu/.ssh/authorized_keys /root/.ssh/