Skip to content

Instantly share code, notes, and snippets.

View thokra's full-sized avatar

Thomas Krampl thokra

View GitHub Profile
class SvgController < ApplicationController
require 'active_support/secure_random'
def create
# create an SVG image
# based on Highcharts index.php
batik_path = Rails.root.to_s() + '/vendor/batik/batik-rasterizer.jar'
svg = params[:svg]
filename = params[:filename].blank? ? "chart" : params[:filename]
class UpdateFeeds < DJ::Worker
re_enqueue
def run_at
10.second.from_now
end
def perform
puts "HELLO!!"
end
source :gemcutter
gem "rails", ">=3.0.0"
gem 'rake'
gem 'twitter' #, :version => '0.9.4'
gem "loofah", :git => "git://github.com/muscardinus/loofah.git"
gem "feedzirra"
gem 'exception_notification'
gem 'json', '1.4.3'
gem 'mysql'
GIT
remote: git://github.com/jakepaul/authlogic.git
revision: 44d3c8d
specs:
authlogic (2.1.5)
activesupport
GIT
remote: git://github.com/muscardinus/loofah.git
revision: aaa58cc
@thokra
thokra / Ride4Ruby.rb
Created January 11, 2011 11:16
Set to true on line 44 to find bicycle routes
require 'net/http'
require 'rexml/document'
MAPS_KEY = ''
UNIT = 'imperial' # or 'metric' (For us that uses the metric system)
states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 'Georgia',
'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',
'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia',
@thokra
thokra / gist:818689
Created February 9, 2011 15:50
jQuery fix
$.ajaxSetup({
headers: {
"X-CSRF-Token": $("meta[name='csrf-token']").attr('content')
}
});
@thokra
thokra / Terminal
Created July 10, 2011 00:12
Remove a local Software updater
cd /Library/Managed Preferences/[username]
sudo mv com.apple.SoftwareUpdate.plist com.apple.SoftwareUpdate.back
sudo touch com.apple.SoftwareUpdate.plist
@thokra
thokra / gist:1170236
Created August 25, 2011 08:34
Quick install
#!/usr/bin/env bash
echo "Checking for SSH key, generating one if it doesn't exist ..."
[[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -t rsa
echo "Copying public key to clipboard. Paste it into your Github account ..."
[[ -f ~/.ssh/id_rsa.pub ]] && cat ~/.ssh/id_rsa.pub | pbcopy
open https://github.com/account/ssh
echo "Installing Homebrew, a good OS X package manager ..."
$(document).ready(function () {
$('#load_fade').fadeOut(1000);
var currOffset = 0;
var itemWidth = 976;
var entries = $(".entry");
var numProjects = entries.length;
$(document).keydown(function (e) {
var current;
@thokra
thokra / add_wp_security.rb
Created February 29, 2012 12:48
Quick and dirty wp security thing. Renaming constants, filenames and directorynames
#!/usr/bin/env ruby
# encoding: utf-8
if RUBY_VERSION.to_f < 1.9
raise "You have to use ruby 1.9 or higher"
end
require 'fileutils'
RENAME_FILES = true