Skip to content

Instantly share code, notes, and snippets.

@simonc
simonc / Gemfile
Last active August 29, 2015 14:20
This is a PoC about testing CSS with RSpec
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'rspec-rails'
@simonc
simonc / iplist.rb
Created October 14, 2009 19:03
Extracts interfaces name and IP address from ifconfig
#!/usr/bin/env ruby
`ifconfig -a`.split(/\n[^\t]/).each do |iface|
name = iface.match(/^(.*?):/)[1]
match = iface.match(/inet ((\d+\.?){4})/)
if match
inet = match[1]
puts "#{name}\t#{inet}"
end
@simonc
simonc / tag_music.sh
Created October 14, 2009 19:06
Functions to add ID3 tags to mp3 files from their name
#!/usr/bin/env bash
tag_tracks ()
{
reg_name="s/^\([0-9]\{2\}\)___\(.*\)\.\(mp3\|ogg\)/\2/"
if [ -f ./Folder.jpg ]; then
img='./Folder.jpg'
else
if [ -f ../Folder.jpg ]; then
@simonc
simonc / commits_for
Created October 14, 2009 19:21
Call svn log for a specific user
#!/usr/bin/env bash
username=$1
options=$2
list=''
for r in `svn log | grep $username | sed 's/r\([0-9]\+\).*/\1/'`; do
list="$list -r$r"
done
*.swp
.DS_Store
.sass-cache
config/database.yml
db/schema.rb
log/*
public/stylesheets/*.css
tmp/*
@simonc
simonc / subversion-unicode-path.patch
Created June 11, 2010 12:27
Subversion Unicode Path Patch
diff --git a/subversion/libsvn_subr/path.c b/subversion/libsvn_subr/path.c
===================================================================
--- a/subversion/libsvn_subr/path.c
+++ b/subversion/libsvn_subr/path.c
@@ -35,6 +35,10 @@
#include "private_uri.h"
+#if defined(DARWIN)
+#include <CoreFoundation/CoreFoundation.h>
@simonc
simonc / commit-msg.rb
Created July 20, 2010 14:49
commit-msg
#!/usr/bin/env ruby
file = ARGV.first
branch = `git br --no-color | grep '^*' | cut -d' ' -f2`.gsub(/ref-(\d+)-.*/, '\1').strip
open('/tmp/git_debug', 'a') { |f| f.puts branch }
msg = ''
if branch =~ /^\d+$/s
@simonc
simonc / human.rb
Created September 9, 2011 17:41
Human DNA
class Human
attr_reader :smart
def initialize
@smart = (rand == rand)
end
end

Simple belongsTo select

This is the simplest version I could get working for a belongsTo association in a form select with EmberJS.

Ember.Select is now deprecated and should not be used.

The eq helper

It uses ember-truth-helpers to have the eq helper.

@simonc
simonc / devise.fr.yml
Last active October 3, 2015 08:38
French translation of devise.en.yml
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
fr:
devise:
confirmations:
confirmed: 'Votre compte a été validé.'
send_instructions: 'Vous allez recevoir les instructions nécessaires à la confirmation de votre compte dans quelques minutes.'
send_paranoid_instructions: 'Si votre e-mail existe dans notre base de données, vous allez bientôt recevoir un e-mail contenant les instructions de confirmation de votre compte.'
failure:
already_authenticated: "Vous êtes déjà connecté !"