Skip to content

Instantly share code, notes, and snippets.

View olleolleolle's full-sized avatar
🙌
In sunny Malmö in Sweden 🌞

Olle Jonsson olleolleolle

🙌
In sunny Malmö in Sweden 🌞
View GitHub Profile
@marick
marick / xp2016.md
Last active February 28, 2016 00:48
Draft abstract for XP2016 talk

"Things are the way they are because they got that way." - Gerald Weinberg

XP, like everything else, contains traces of its history - traces that, to an outsider, seem arbitrary. The same is true of functional programming (FP). The histories of XP and FP have had little influence on each other. As a fan of both, I think that's a problem.

Possibly it's more of a problem for FP: I see XP insights being painfully and expensively rediscovered.

It's also a problem for XP. When Agile became popular, XP was eclipsed because (1) it requires a lot of discipline, and (2) it focuses on "that point in the proceedings [where] someone competent has to write some damn code" [told to me by a speaker at this conference who, at the time, wanted to remain anonymous]". As Agile became a management fad, that made XP unappealing.

FP is (arguably) at the point object-oriented programming was during XP's heydey: people with money to spend on programmers are willing to risk it on programmers programming in weird ways. IF XP can

@halfbyte
halfbyte / Gemfile
Created December 21, 2014 01:22
A Simple Calendar generator. Very specific for my case - Probably going to make it more configurable one day.
source "https://rubygems.org"
gem "prawn"
@ftrain
ftrain / actually.js
Last active November 10, 2023 01:16
A program that generates actuallies
/*
actually.js
_ _ _
__ _ __ _ __ _ __ _ ___| |_ _ _ __ _| | |_ _
/ _` |/ _` |/ _` |/ _` |/ __| __| | | |/ _` | | | | | |
| (_| | (_| | (_| | (_| | (__| |_| |_| | (_| | | | |_| |_
\__,_|\__,_|\__,_|\__,_|\___|\__|\__,_|\__,_|_|_|\__, ( )
|___/|/
*/
@tamoyal
tamoyal / gist:10441108
Created April 11, 2014 04:39
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@tolnem
tolnem / kontrol.py
Last active February 12, 2024 13:46
Reading midi input from nanoKontrol 2 in python, using python-rtmidi and jack-audio
#!/usr/bin/python
import rtmidi, time
buttons = {
58: 'track_left',
59: 'track_right',
46: 'cycle',
60: 'marker_set',
61: 'marker_left',
@bjonord
bjonord / CreateExtensionsForDb.rb
Created November 2, 2013 11:54
earth_box in ActiveRecord
# Migration to add cube and earthdistance extensions.
class CreatePostgresExtensions < ActiveRecord::Migration
def up
ActiveRecord::Base.connection.execute("CREATE EXTENSION cube;")
ActiveRecord::Base.connection.execute("CREATE EXTENSION earthdistance;")
end
def down
ActiveRecord::Base.connection.execute("DROP EXTENSION earthdistance;")
ActiveRecord::Base.connection.execute("DROP EXTENSION cube;")
@nellshamrell
nellshamrell / Beneath the Surface: Embracing the True Power of Regular Expressions in Ruby
Last active December 3, 2017 16:35
Resources I consulted when preparing my presentation "Beneath the Surface: Embracing the True Power of Regular Expressions in Ruby"
All of these resources were extremely valuable as I researched regex, finite state machines, and regex in Ruby. Check them out, they're full of fantastic information!
Articles
"Exploring Ruby's Regular Expression Algorithm" by Pat Shaughnessy
http://patshaughnessy.net/2012/4/3/exploring-rubys-regular-expression-algorithm
"Finite State Machines and Regular Expressions" by Eli Bendersky
http://www.gamedev.net/page/resources/_/technical/general-programming/finite-state-machines-and-regular-expressions-r3176
"Regular Expression Matching Can Be Simple and Fast" by Russ Cox
@SunboX
SunboX / inlineworker.js
Created June 24, 2013 12:21
Create web workers without a separate worker JS files. Source: http://jsbin.com/owogib/8/
function worker() {
setInterval(function() {
postMessage({foo: "bar"});
}, 1000);
}
var code = worker.toString();
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}"));
var blob = new Blob([code], {type: "application/javascript"});
@ziadoz
ziadoz / halt_compiler.php
Last active April 23, 2024 17:55
Using PHP Halt Compiler
<?php
/**
* The __halt_compiler() function will stop the PHP compiler when called.
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt.
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating.
* The template is stored in a temporary file so it can be included and parsed.
*
* See: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php
* http://php.net/manual/en/function.halt-compiler.php
*/