Skip to content

Instantly share code, notes, and snippets.

View wallymathieu's full-sized avatar

Oskar Gewalli wallymathieu

View GitHub Profile
@henrik
henrik / personnummer.rb
Created January 29, 2009 11:53
Generate valid Swedish personnummer.
# Generator for valid Swedish personnummer: http://en.wikipedia.org/wiki/Personal_identity_number_(Sweden)
# By Henrik Nyh <http://henrik.nyh.se> 2009-01-29 under the MIT license.
require 'date'
module Personnummer
def self.generate(date=nil, serial=nil)
date ||= Date.new(1900+rand(100), 1+rand(12), 1+rand(28))
serial = serial ? serial.to_s : format("%03d", 1+rand(999)) # 001-999
Getting up and running with OS X, Textmate & Scheme
===================================================
SCHEME
======
I ran across two implementations of Scheme which appear to work well with OS X.
mit-scheme & PLT Scheme.
I was able to install mit-scheme from darwin ports ( sudo port install mit-scheme)
@jimeh
jimeh / com.rabbitmq.rabbitmq-server.plist
Created March 24, 2011 10:47
Mac OS X launchctl plist for Homebrew-based RabbitMQ installations. Place in: ~/Library/LaunchAgents
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.rabbitmq.rabbitmq-server</string>
<key>Program</key>
<string>/usr/local/sbin/rabbitmq-server</string>
@topfunky
topfunky / Cakefile
Created April 14, 2011 22:18
Watch both Sass and Coffee files and compile on change (for Node.js)
###
Modified from https://github.com/jashkenas/coffee-script/blob/master/Cakefile
Part of an upcoming PeepCode screencast. This snippet is MIT Licensed.
###
{spawn, exec} = require 'child_process'
task 'assets:watch', 'Watch source files and build JS & CSS', (options) ->
runCommand = (name, args) ->
@pmarreck
pmarreck / Ruby.sublime-build
Last active December 10, 2023 20:00
Get Sublime Text 2 (or 3) to use your RVM ruby and bundle Gemfile
# Get Sublime to use your rvm ruby... Change your ~/Library/Application Support/Sublime Text 2/Packages/Ruby/Ruby.sublime-build
# (for ST3: ~/Library/Application Support/Sublime Text 3/Packages/User/Ruby.sublime-build) to this, replacing YOURUSERNAME.
# I am still looking to optimize this further... For example, avoiding hardcoding by using something like $HOME, although
# I have yet to get any form of that to work.
{
"working_dir": "${project_path}",
"cmd": [
"/Users/YOURUSERNAME/.rvm/bin/rvm-auto-ruby", "-Ilib:test", "$file"
],
@sciolist
sciolist / example.rb
Created August 16, 2012 20:46
Use some simple ngrams to figure out what method you wanted to call!
require './oh_god_why'
class Object
include FigureItOut
end
str = "hello, world."
puts str.make_upper_case # HELLO, WORLD.
this = "this be some text"
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public class ಠ_ಠAttribute : Attribute
{
public ILog Log { get; set; }
public ಠ_ಠAttribute()
{
Log.Info("This code is bad and you should feel bad");
}
}
@AnthonyMastrean
AnthonyMastrean / nuspec.rb
Created September 27, 2012 21:32
Automatic discovery of NuGet dependencies.
def auto_add_dependencies(projects)
projects.each do |project|
each_project_dependency do |dependency|
@dependencies.push dependency
end
end
end
def get_packages_config(project)
return File.join File.dirname project, 'packages.config'
@mausch
mausch / gist:4260932
Created December 11, 2012 18:40
Lenses as category in F#
#r @"bin\debug\FsControl.Core.dll" // from https://github.com/gmpl/FsControl
open System
open FsControl.Core.Abstractions
// generic composition operators for all categories
let inline (>>) g f = Inline.instance (Category.Comp, f) g
let inline (<<) f g = Inline.instance (Category.Comp, f) g
// Lens definition
@mat-mcloughlin
mat-mcloughlin / ಠ_ಠAttribute.cs
Created December 11, 2013 16:33
This code is bad and you should feel bad
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public class ಠ_ಠAttribute : Attribute
{
public ILog Log { get; set; }
public ಠ_ಠAttribute()
{
Log.Info("This code is bad and you should feel bad");
}
}