Skip to content

Instantly share code, notes, and snippets.

View rhaamo's full-sized avatar
💭
squeak squeak

Valérianne rhaamo

💭
squeak squeak
View GitHub Profile
anonymous
anonymous / syntax_for_redcloth.rb
Created April 30, 2009 07:09
Using CodeRay -and- Syntax with RedCloth
#
# Using CodeRay -and- Syntax with RedCloth
#
# Setup both gems in config/environment.rb
# config.gem "syntax", :version => '1.0.0'
# config.gem "coderay", :version => '0.8.312'
#
# Then drop this in config/initializers
#
# Now you can:
@defunkt
defunkt / gist:449668
Created June 23, 2010 08:55 — forked from dustin/gist:397971
Emacs Lisp to automatically add, commit, and push when files change
;; Automatically add, commit, and push when files change.
(defvar autocommit-dir-set '()
"Set of directories for which there is a pending timer job")
(defun autocommit-schedule-commit (dn)
"Schedule an autocommit (and push) if one is not already scheduled for the given dir."
(if (null (member dn autocommit-dir-set))
(progn
(run-with-idle-timer
all: foo bar baz
foo:
git pull
bar:
scp carotte:~/sync.log pertes\ sync\ ligne\ adsl
git commit -a -m "Update with new file"
baz:
#!/usr/bin/env python
"""
arrange your films (with a name like "american_history_x.avi") on your filesystem:
BASEDIR/
./date/1998/american_history_x.avi (symlink)
./genre/drama/american_history_x.avi (symlink)
./genre/crime/american_history_x.avi (symlink)
./actor/edward furlong/american_history_x.avi (symlink)
@krikulis
krikulis / evserver.c
Created January 24, 2011 13:13
Simple evhttp example
#include <evhttp.h>
void process_request(struct evhttp_request *req, void *arg){
struct evbuffer *buf = evbuffer_new();
if (buf == NULL) return;
evbuffer_add_printf(buf, "Requested: %s\n", evhttp_request_uri(req));
evhttp_send_reply(req, HTTP_OK, "OK", buf);
}
int main () {
@mcansky
mcansky / gist:846201
Created February 27, 2011 14:11
some jquery
$("span.repo_update").click(function() {
/*$("#repo_"+$(this).attr('title')+'_gif').fadeToggle();*/
$.getJSON("/update_repo/" + $(this).attr('rel') + "&format=json",
function(data) {
console.log(data);
$('.repo_stuff').fadeOut();
$("#"+data["div_id"]).html('');
for (var issue in data.issues)
{
/*= issue.edited_at.strftime("%d/%m/%Y %H:%M")
anonymous
anonymous / gist:861989
Created March 9, 2011 10:09
http://onestepback.org/index.cgi/Tech/Ruby/Metaclasses.red
http://obiefernandez.com/presentations/obie_fernandez-agile_dsl_development_in_ruby.pdf
http://weblog.jamisbuck.org/2006/4/20/writing-domain-specific-languages
http://martinfowler.com/dslwip/
http://www.artima.com/rubycs/articles/ruby_as_dsl4.html
http://www.jroller.com/rolsen/entry/building_a_dsl_in_ruby1
http://weblog.raganwald.com/2007/03/approach-to-composing-domain-specific.html
http://raganwald.com/source/dsl_and_let.html
http://www.infoq.com/presentations/vanderburg-state-of-dsl-ruby
http://www.infoq.com/presentations/5W-of-DSL
@takumikinjo
takumikinjo / org2doku
Created March 21, 2011 07:19
Convert Emacs org-mode formatted text to Dokuwiki formatted one.
#!/usr/bin/env perl
# Usage
#
# cat <<EOF | ./org2doku
# * heading
#
# - item
# - sub item
#
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@chrisbloom7
chrisbloom7 / README.md
Created June 6, 2011 07:16
A cheap knock off of the default validates_length_of validator, but checks the filesize of a Carrierwave attachment

Note that this validation runs both after the file is uploaded and after CarrierWave has processed the image. If your base uploader includes a filter to resize the image then the validation will be run against the resized image, not the original one that was uploaded. If this causes a problem for you, then you should avoid using a resizing filter on the base uploader and put any specific size requirements in a version instead.

So instead of this:

require 'carrierwave/processing/mini_magick'