Skip to content

Instantly share code, notes, and snippets.

View andyjeffries's full-sized avatar

Andy Jeffries andyjeffries

View GitHub Profile
fdjstage:
rails_env: fdjstage_public
rails_root: /home/fdjstage-public/fortaleza/current
cap_binary: /home/agp/local/ruby-ee/bin/cap
ruby_binary: /home/agp/local/ruby-ee/bin/ruby
rubyrep_binary: /home/agp/local/ruby-ee/bin/rubyrep
ssh_key: /home/agp/.ssh/id_rsa
user: agp
database:
adapter: mysql
FDJ = {}
FDJ.EventScroller = {
init: function() {
setTimeout(function() {
FDJ.EventScroller.start_all();
}, 3000);
console.log("Setting timeout - done");
},
start_all: function() {
$(".wrapper").each(function() {
<!--
Replace the sections with {} with their real values
Add the content
Convert it with:
html2mobi --author "{AUTHOR GOES HERE}" this.html
-->
<html>
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<title>{TITLE GOES HERE}</title>
#!/usr/bin/env ruby -w
require 'rubygems'
require 'Text'
results = {}
Dir.glob("top100_*.txt") do |filename|
File.read(filename).split("\n").each do |song|
stripped = song.gsub(/[^a-z0-9]/, '').downcase
# MIGRATION
class CreateBasicTables < ActiveRecord::Migration
def self.up
create_table :books, :force => true do |t|
t.string :title
t.timestamps
end
create_table :authors, :force => true do |t|
t.string :name
@andyjeffries
andyjeffries / gist:348897
Created March 30, 2010 08:10
A short textmate wrapper command
#!/usr/bin/env ruby
if ARGV.size == 0
lines = `ls -1 *.tmproj 2>/dev/null`.split("\n")
if lines.size == 1
`open #{lines[0]}`
else
`mate .`
end
else
@andyjeffries
andyjeffries / internal_redirect_to.rb
Created June 16, 2010 13:47
Internal redirect_to for Rails 2.x
# This is an internal_redirect_to function by Sandro Paganotti
# http://www.railsonwave.com/2008/10/25/how-to-call-a-controller-s-action-from-a-different-controller
# By using this internal_redirect_to function you will be able to
# get the same results as a normal redirect_to without send anything
# to the user, only keep in mind to explicit invoke the return after
# this function.
class ApplicationController
def internal_redirect_to (options={})
diff --git a/lib/paperclip.rb b/lib/paperclip.rb
index f40fe79..c043970 100644
--- a/lib/paperclip.rb
+++ b/lib/paperclip.rb
@@ -171,7 +171,7 @@ module Paperclip
# that can control permissions. You can specify the full domain and path, but usually
# just an absolute path is sufficient. The leading slash *must* be included manually for
# absolute paths. The default value is
- # "/system/:attachment/:id/:style/:filename". See
+ # "/system/:class/:attachment/:id/:style/:filename". See

The following articles were sent after a conversation I had about the fact that people need 8-10 glasses of water per day. I had read that this wasn’t the case it was a single scientist a long while ago and pretty much every scientist since then that’s studied it has found it to be crap. Below are the references I found. Note, I’m not saying that you shouldn’t drink that much water if you want to, but that if you don’t want to you shouldn’t have to.

_After an extensive search in 2002 for the origins of what is commonly referred to as the “8 × 8” guideline and areview of associated health claims, hereports finding no scientific evidence supporting the notion that healthy individuals need to consume large quantities of water. In 2008 Dan Negoianu and Stanley Goldfarb reviewed the evidence for the Journal of the American Society of Nephrology. They came to a similar conclusion: “There is no clear evidence of benefit from drinking increased amounts of water.”…come from a variety of sources—including coffee,

@andyjeffries
andyjeffries / psg
Created August 19, 2011 10:41
Process Grepper and Killer for Mac OS X
#!/usr/bin/env ruby
kill = false
name = ARGV[0]
if (name == "-k")
kill = true
name = ARGV[1]
end
if name
ps = `ps axwu|grep -i [#{name[0..0]}]#{name[1..1000]}|grep -v " #{Process.pid}"`