Skip to content

Instantly share code, notes, and snippets.

View iGEL's full-sized avatar

Johannes Barre iGEL

View GitHub Profile
# From http://www.regular-expressions.info/email.html
# Do NOT use it!
/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/
# Another example with YAML. Consider this file (the <c> is my cursor):
en:
test:
hello: "World"<c>
# Now I press Enter
en:
test:
hello: "World"
From e8c5bc23295e6a5ead501a74e73ac4cca507d3d8 Mon Sep 17 00:00:00 2001
From: Johannes Barre <igel@igels.net>
Date: Sat, 23 Jul 2011 11:03:23 +0200
Subject: [PATCH] Use svn switch instead of svn update
---
lib/capistrano/recipes/deploy/scm/subversion.rb | 8 +++++---
test/deploy/scm/subversion_test.rb | 7 +++++++
2 files changed, 12 insertions(+), 3 deletions(-)
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gem 'mysql2'
gem 'json'
gem 'fast-aes'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
server {
listen 80;
server_name stage.example.com;
access_log /var/log/nginx/stage.example.com.access.log;
error_log /var/log/nginx/stage.example.com.error.log warn;
root /home/igel/www/stage.example.com/current/public;
passenger_enabled on;
rails_env stage;
error_page 503 /system/maintenance.html;
location / {
passenger_enabled on;
if ( -f $document_root/system/maintenance.html ) {
return 503;
}
}
location = /system/maintenance.html {
}
@iGEL
iGEL / gist:3137210
Created July 18, 2012 16:12
Get a Date (the Monday) of a given ISO 8601 week by it's week number in Ruby
class Date
# Returns the monday of the given week number
def self.by_iso_weekno(year, weekno)
# January 4th is always in the first week according to ISO 8601
date = Date.civil(year, 1, 4) + (weekno - 1) * 7
date - (date.wday != 0 ? date.wday - 1 : 6) % 7
end
end
@iGEL
iGEL / prepare-commit-msg
Last active December 22, 2015 17:59
Gets the Trello card ID from your branch name and includes it into the commit message
#!/bin/bash
# Takes the last token of the branch name (separated with an underscore)
# takes adds is into the commit message.
#
# Note: If you want to about committing from the editor, remove the tag and save the file
#
# 1) Put this file into .git/hooks/prepare-commit-msg
# 2) Make it executable: chmod +x .git/hooks/prepare-commit-message
@iGEL
iGEL / .Xresources
Last active August 31, 2020 11:26
Xft.dpi: 96
URxvt.font: xft:DejaVu\ Sans\ Mono:size=11
URxvt.scrollBar: off
URxvt.saveLines: 4096
URxvt.perl-ext-common: default,url-select,keyboard-select,font-size,clipboard
URxvt.urlLauncher: xdg-open
@iGEL
iGEL / build_light
Last active August 29, 2015 13:56
Build light
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'uri'
class Light
GREEN_ID = 4762304
RED_ID = 4762303