This file contains hidden or 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
# before | |
# solution from member of team | |
if hash["#{PRODUCT_TYPEID_VDC}"].nil? && hash["#{PRODUCT_TYPEID_PRIVATECLOUD}"].nil? | |
hash["#{PRODUCT_TYPEID_VDC}"] = hash["#{PRODUCT_TYPEID_CLOUD}"] | |
elsif hash["#{PRODUCT_TYPEID_VDC}"].nil? && hash["#{PRODUCT_TYPEID_CLOUD}"].nil? | |
hash["#{PRODUCT_TYPEID_VDC}"] = hash["#{PRODUCT_TYPEID_PRIVATECLOUD}"] | |
elsif hash["#{PRODUCT_TYPEID_CLOUD}"].nil? | |
hash["#{PRODUCT_TYPEID_VDC}"] += hash["#{PRODUCT_TYPEID_PRIVATECLOUD}"] unless hash["#{PRODUCT_TYPEID_PRIVATECLOUD}"].nil? | |
elsif hash["#{PRODUCT_TYPEID_PRIVATECLOUD}"].nil? | |
hash["#{PRODUCT_TYPEID_VDC}"] += hash["#{PRODUCT_TYPEID_CLOUD}"] unless hash["#{PRODUCT_TYPEID_CLOUD}"].nil? |
This file contains hidden or 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 'singleton' | |
require 'active_support' | |
class TimeToLive | |
include Singleton | |
attr_reader :start_time | |
def initialize | |
@live = true |
This file contains hidden or 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
# research about this | |
Marshal.load(Marshal.dump(variable)) |
This file contains hidden or 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
# create user | |
createuser --interactive -P role_name | |
# remove user | |
dropuser role_name |
This file contains hidden or 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
# start the ssh-agent in the background | |
eval "$(ssh-agent -s)" | |
# Agent pid 59566 | |
ssh-add ~/.ssh/id_rsa |
This file contains hidden or 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
Mode | Meaning | |
-----+-------------------------------------------------------- | |
"r" | Read-only, starts at beginning of file (default mode). | |
-----+-------------------------------------------------------- | |
"r+" | Read-write, starts at beginning of file. | |
-----+-------------------------------------------------------- | |
"w" | Write-only, truncates existing file | |
| to zero length or creates a new file for writing. | |
-----+-------------------------------------------------------- | |
"w+" | Read-write, truncates existing file to zero length |
This file contains hidden or 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
One liner to stop / remove all of Docker containers: | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) |
This file contains hidden or 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
var Vector = function(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
Vector.prototype.plus = function(vector) { | |
return new Vector.new(this.x + vector.x, this.y + vector.y) | |
} | |
Vector.prototype.minus = function(vector) { |
This file contains hidden or 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
> brew install gcc48 | |
> CC=gcc-4.8 rbenv install 1.8.7-p375 |
This file contains hidden or 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 A | |
@foo = :foo | |
@@bar = :bar | |
attr_reader :foo | |
def foo | |
@foo = :bla | |
end |
OlderNewer