Skip to content

Instantly share code, notes, and snippets.

View bullfight's full-sized avatar
🚀

Patrick Schmitz bullfight

🚀
View GitHub Profile
@billgathen
billgathen / gol.exs
Last active August 29, 2015 14:05 — forked from avdi/gol.exs
Elixir 0.15.1-compatible version of @avdi implementation of Conway's Game of Life
defmodule Life do
def run(board) when is_binary(board) do
board |> parse_board |> run
end
def run(board) do
IO.write("\e[H\e[2J")
Life.print_board board
:timer.sleep 1000
board = next_board(board)
require "rubygems"
require "net/http"
require "open-uri"
data = open("http://cdo.ncdc.noaa.gov/climatenormals/clim84/IL/IL110055.txt").map
#data = open("http://cdo.ncdc.noaa.gov/climatenormals/clim84/IL/IL112679.txt").map
metric = {}
metric[:station_coop_id] = data[4][44..49]
@cblunt
cblunt / factories.rb
Created October 15, 2010 14:01 — forked from technicalpickles/factories.rb
Simulate paperclip attachments with FactoryGirl in Rails 3
Factory.define :application do |factory|
factory.attachment :sample, "public/samples/sample.doc", "application/msword"
end
anonymous
anonymous / directory_web_service.rb
Created January 29, 2011 00:18
require 'mechanize'
require 'nokogiri'
require 'sinatra'
get '/:psuid' do
find_name params[:psuid]
end
def find_name(psuid)
@gunn
gunn / directory_web_service.rb
Created January 29, 2011 10:44 — forked from anonymous/directory_web_service.rb
Refactor of some code from a blog post.
require 'mechanize'
require 'nokogiri'
require 'sinatra'
get '/:psuid' do
find_name params[:psuid]
end
def find_name(psuid)
@sra448
sra448 / tail.py
Created November 9, 2011 16:44
sublime text 2 command for tailing and greping the rails logfile
import sublime, sublime_plugin, os
class TailCommand(sublime_plugin.TextCommand):
def run(self, edit):
from datetime import datetime
filtertext = "FLO"
# open sublime console
self.view.window().run_command("show_panel", { "panel": "console", "toggle": "true" })
@edhedges
edhedges / gist:2995805
Created June 26, 2012 13:30
Sublime Text 2 - Useful Shortcuts (Mac OS X)

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@freeformz
freeformz / README.md
Created August 16, 2012 23:49
Using Heroku's Postgres's Fork feature to make/update staging dbs

This script assumes the following:

  1. Your app is named 'something' and that your staging app is named 'something-staging'. This seems to be a common thing.
  2. You only have a single staging HEROKU_POSTGRESQL databae.

Totally untested. 😏

What does it do?

  1. Grabs the current db name
attachments: parent_id, asset_id
domain_names: organisation_id
event_memberships: user_id, event_id
events: editor_id
group_actions: user_id, group_id
groups: user_id
icons: parent_id
invitations: sender_id
legacy_actions: item_upon_id
news_items: author_id
@eliotsykes
eliotsykes / asset_server_middleware.rb
Last active December 20, 2015 01:29
***** Checkout the rack-zippy gem, I recommend it over this gist, find it at https://github.com/eliotsykes/rack-zippy ***** An asset server for Rails 3.2.x that serves asset pipeline precompiled assets to clients, including those elusive gzipped (.gz) assets. Sadly Rails' own ActionDispatch::Static middleware does not take care of serving gzippe…
# 1. Add rack-rewrite to your Gemfile and run 'bundle install':
# gem 'rack-rewrite'
#
# 2. Create a file with the contents below in config/initializers/asset_server_middleware.rb
#
# 3. Rename 'YourApp' below
#
# 4. In config/environments/production.rb and config/environments/test.rb, set:
# config.serve_static_assets = true
# config.assets.compile = false