Skip to content

Instantly share code, notes, and snippets.

# Run this with jboss-cli to deplyo the given module:
module add --name=com.mydomain.placeholder --resources=placeholder\target\placeholder-6.6.6-SNAPSHOT.jar
/subsystem=ee:write-attribute(name="global-modules",value=[{"name" => "com.mydomain.placeholder","slot" => "main"}])
@oscarrenalias
oscarrenalias / colorize.rb
Created February 21, 2013 08:07
Easily colorize console output in Ruby:
class String
# colorization
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
def red
colorize(31)
end
var https = require('https');
// https://www.yammer.com/api/v1/messages.json
var options = {
host: 'www.yammer.com',
path: '/api/v1/messages.json?access_token=YOUR-OAUTH2-TOKEN',
headers: { "Authorization": "Bearer YOUR-OAUTH2-TOKEN" }
}
var globalRequestId = 1;
@oscarrenalias
oscarrenalias / gist:4258354
Created December 11, 2012 12:57
Using Puppet to provision instances from EC2 and automatically install Puppet agent on them
#!/bin/sh
puppet node_aws bootstrap \
--debug \
--image ami-c1aaabb5 \
--keyname 'puppet_provisioner' \
--type 'm1.small' \
--region eu-west-1 \
--security-group puppet-clients \
--login ubuntu \
@oscarrenalias
oscarrenalias / framework.scala
Created October 5, 2012 20:20
This is small implementation of a tiny MVC-oriented framework inspired by the design * of the Play Framework 2.0; it is meant as an educational exercise to get more familiar with * the concepts of partial functions, function composition and generic type
/**
* This is small implementation of a tiny MVC-oriented framework inspired by the design
* of the Play Framework 2.0; it is meant as an educational exercise to get more familiar with
* the concepts of partial functions, function composition and generic types in Scala
*
* How to run:
* scalac framework.scala
* scala App
*/
@oscarrenalias
oscarrenalias / type-bounds.scala
Created October 4, 2012 18:50 — forked from retronym/type-bounds.scala
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
@oscarrenalias
oscarrenalias / configuration.scala
Created October 2, 2012 21:40
Type-safe configuration in Scala
trait Handler
class Handler1 extends Handler
class Handler2 extends Handler
trait HandlerConfiguration {
val handler1: Handler
val handler2: Handler
}
@oscarrenalias
oscarrenalias / node-event-emitter.js
Created September 10, 2012 18:47
An example of an event emitter class in Node.js
var events = require('events'),
util = require('util');
EventGenerator = function() {
events.EventEmitter.call(this);
this.read = function() {
var data = "this is new data";
this.emit("data", data);
}
@oscarrenalias
oscarrenalias / git-colors.sh
Created August 24, 2012 18:22
Enabling git integration with Bash in OS X
git config --global color.branch auto
git config --global color.diff auto
git config --global color.status auto
* List of commits not pushed to origin yet:
git log origin/master..master