This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module XptoModule | |
class << self | |
attr_accessor :classes_with_xpto_module | |
end | |
self.classes_with_xpto_module = [] | |
def self.included(base) | |
self.classes_with_xpto_module << base | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VAR1=BlaBlaBla | |
$VAR1=PqPqPqPq | |
function export_ambient_variable_for() { | |
if [[ $1 = 'prod' ]]; then | |
echo 'Exporting ambient variables for Prod environment' | |
export ZZZZ=$VAR1 | |
else | |
echo 'Exporting ambient variables for Dev environment' | |
export ZZZZ=$VAR2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model | |
def method(&block) | |
puts "START" | |
block.call | |
puts "END" | |
end | |
def second(&block) | |
puts "SECOND - START" | |
method(&block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Getting the Exception 1" | |
begin | |
eval("1+") | |
rescue Exception => e | |
puts "Exception Class => #{e.class} - Message: #{e}" | |
end | |
puts "Getting the Exception 2" | |
begin | |
eval("1+") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source => http://www.adafruit.com/forums/viewtopic.php?f=25&t=34567 | |
//code https://gist.github.com/1804108 20121125 @ 1339 | |
//led for visualization (use 13 for built-in led) | |
int ledPin = 13; | |
//speaker connected to one of the pwm ports | |
int speakerPin = 9; | |
//tone frequencies http://home.mit.bme.hu/~bako/tonecalc/tonecalc.htm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host *.staging.something.com | |
User someuser | |
ForwardAgent yes | |
LocalForward localhost:43306 localhost:3306 | |
LocalForward localhost:49200 localhost:9200 | |
LocalForward localhost:49001 localhost:9001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "Wow Coins" do | |
let(:klasz_class) do | |
Class.new do | |
attr_reader :title | |
def initialize(properties) | |
@title = properties[:title] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rules: A lamda always has 1 parameter, nothing more, nothing less | |
# Useful Content: https://en.wikipedia.org/wiki/Church_encoding | |
# Identity lambda | |
IDENTITY = ->x { x } | |
# True, returns the first argument | |
TT = ->x { ->y { x } } | |
# False, returns the last argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to Use | |
# open -a XQuartz | |
# socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" | |
# docker build . -t ds-xclock | |
# docker run -e DISPLAY=YOUR_LOCAL_IP_HERE:0 -it ds-xclock | |
# | |
# Useful Links: | |
# https://github.com/moby/moby/issues/8710 | |
# http://kartoza.com/en/blog/how-to-run-a-linux-gui-application-on-osx-using-docker/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loan Env Variables | |
while read line; do | |
export $(echo $line | sed 's/"//g') | |
done < /etc/environment |