Skip to content

Instantly share code, notes, and snippets.

View masterkain's full-sized avatar
🤖

Kain masterkain

🤖
View GitHub Profile
@masterkain
masterkain / nginx_rails_3_1
Created April 17, 2012 20:03 — forked from shapeshed/nginx_rails_3_1
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
require "resque"
require "resque/failure/multiple"
require "resque/failure/redis"
# Configure Resque connection from config/redis.yml. This file should look
# something like:
# development: localhost:6379
# test: localhost:6379:15
# production: localhost:6379
Resque.redis = YAML.load_file(Rails.root + 'config/redis.yml')[Rails.env]
@masterkain
masterkain / lastfm.rb
Created May 27, 2011 22:20 — forked from lucasmazza/lastfm.rb
a Last.FM Strategy for OmniAuth
require 'omniauth/core'
require 'digest/md5'
require 'rest-client'
require 'multi_json'
module OmniAuth
module Strategies
class Lastfm
include OmniAuth::Strategy
class Task < ActiveRecord::Base
belongs_to :category
belongs_to :project
validates_presence_of :project_id, :category_id
validates_with OvertimeValidator
scope :of_date, lambda { |date| where(:date => date) }
end
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
<html>
<head>
<title>Fetch Image</title>
<script type="text/javascript" src="index.js"></script>
<link href="index.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h3>Fetch Image From URL:</h3>
<div style='font-weight:bold'>Title</div>
<input id="imgTitle" type="text"></input>
From 4df22d595120e6eef596ebf10e36458b2a88e958 Mon Sep 17 00:00:00 2001
From: Rob Anderton <rob.anderton@thewebfellas.com>
Date: Tue, 30 Mar 2010 16:44:52 +0100
Subject: [PATCH 1/3] fix problems with newer versions of test/unit
---
test/helper.rb | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/helper.rb b/test/helper.rb
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
# Rename an email address in all old commits.
# WARNING: Will change all your commit SHA1s.
# Based off of the script from here:
# http://coffee.geek.nz/how-change-author-git.html
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "joern.zaefferer@googlemail.com" ];
then
GIT_AUTHOR_EMAIL="joern.zaefferer@gmail.com";
GIT_COMMITTER_EMAIL="joern.zaefferer@gmail.com";
git commit-tree "$@";
def browse
root, dir = File.expand_path("."), request[:dir]
@lis = []
begin
path = root + "/" + dir
Dir.chdir(File.expand_path(path)) do
if Dir.pwd[0,root.length] == root then
files = Dir.glob("*")
files.each{ |x|
next unless File.directory?(x)