Skip to content

Instantly share code, notes, and snippets.

View thbar's full-sized avatar

Thibaut Barrère thbar

View GitHub Profile
@thbar
thbar / tweet_oge_price_signal.rb
Created August 1, 2012 19:39 — forked from JEG2/tweet_oge_price_signal.rb
A simple bot for tweeting OGE's daily price signal
require "rest_client"
require "twitter"
URL = "http://www.oge.com/residential-customers/products-and-services/" +
"Positive-Energy-Smart-Grid/Pages/PriceSignal.aspx"
DATE_RE = Time.now.strftime("%A,\\s+%B\\s+%d,\\s+%Y")
unless ARGV.size == 4
abort "USAGE: #{$PROGRAM_NAME} CONSUMER_KEY CONSUMER_SECRET " +
"OAUTH_TOKEN OAUTH_TOKEN_SECRET"
@thbar
thbar / gist:3231472
Created August 1, 2012 23:14 — forked from swannodette/gist:3217582
sudoku_compact.clj
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
(defn init [vars hints]
@thbar
thbar / parallel_assets_compiler.gemspec
Created August 9, 2012 17:20 — forked from joerichsen/parallel_assets_compiler.gemspec
Microgem for compiling assets in parallel
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'parallel_assets_compiler'
s.version = '0.2.0'
s.platform = Gem::Platform::RUBY
s.author = 'Jørgen Orehøj Erichsen'
s.email = '[email protected]'
s.summary = 'Compile assets in parallel'
s.description = 'Compile assets in parallel to speed up deployment'
@thbar
thbar / get_url_params.js.coffee
Created August 15, 2012 08:57 — forked from thorn/get_url_params.js.coffee
getting url params with coffeescript and jquery
# Returns get parameters.
#
# If the desired param does not exist, null will be returned
#
# To get the document params:
# @example value = $(document).getUrlParam("paramName");
#
# To get the params of a html-attribut (uses src attribute)
# @example value = $('#imgLink').getUrlParam("paramName");
jQuery.fn.extend
@thbar
thbar / rubymotion_ispeech.md
Created September 9, 2012 18:19 — forked from seanlilmateus/rubymotion_ispeech.md
Integrating RubyMotion and the iSpeech SDK

#Integrating RubyMotion and the iSpeech SDK

As of 19th July 2012, RubyMotion has a couple of issues with external libraries as I discovered when trying the integration, thanks to Laurent, the architect of RubyMotion and with some prompting from Stéphane Wirtel here is the issue and resolution including the code to make the iPhone speak.

Firstly setting up the app, assuming you've already copied the files you need into your vendor/iSpeechSDK directory this is the code needed in the rakefile as per any normal library ...

app.vendor_project('vendor/iSpeechSDK', :static, :products => ["libiSpeechSDK.a"], :headers_dir => "Headers")

@thbar
thbar / proby
Created November 11, 2012 19:15 — forked from jwood/proby
Proby command line wrapper script
#!/bin/bash
#
# This script surrounds the command passed in with start and finish notifications
# to the Proby task monitoring application.
#
#
# === SETUP
#
# * Make sure the proby script is executable.
#
@thbar
thbar / gemfile_changelog.rb
Created November 22, 2012 09:07 — forked from swrobel/gemfile_changelog.rb
Get Changelogs for outdated gems in Gemfile
#!/usr/bin/env ruby
def changelog_for_gem(gem)
changelogs = `bundle exec gem contents #{gem}`.lines.grep(/history|changelog|news/i)
if changelogs.empty?
puts "No changelog found for gem #{gem}"
return nil
end
@thbar
thbar / redis_on_passenger.rb
Created November 28, 2012 21:04 — forked from krasio/redis_on_passenger.rb
config/initializers/redis_on_passenger.rb
# config/initializers/redis_on_passenger.rb
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
# We're in smart spawning mode.
if forked
# Re-establish redis connection
# disconnect
Resque.redis.client.disconnect
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#
@thbar
thbar / gist:4574991
Created January 19, 2013 20:43 — forked from idan/gist:3135754

Hello there! This is a sample post for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.