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
// (c) copyright unscriptable.com / John Hann | |
// License MIT | |
// For more robust promises, see https://github.com/briancavalier/when.js. | |
function Promise () { | |
this._thens = []; | |
} | |
Promise.prototype = { |
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
check system localhost | |
if loadavg (1min) > 8 then alert | |
if loadavg (5min) > 4 then alert | |
if memory usage > 75% then alert | |
if cpu usage (user) > 70% for 8 cycles then alert | |
if cpu usage (system) > 40% for 8 cycles then alert | |
if cpu usage (wait) > 20% for 8 cycles then alert | |
check process apache with pidfile /var/run/apache2.pid | |
start program = "/etc/init.d/apache2 start" |
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 'erb' | |
class ERBPrivateClass | |
def self.build | |
new('Joao', 'Almeida') | |
end | |
attr_accessor :first_name, :last_name | |
def initialize(first, last) |
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
#!/usr/bin/env ruby | |
%w(yaml ap ostruct).each { |dep| require dep } | |
class Plans | |
attr_accessor :name, :price, :recurrence | |
def initialize(name, price, recurrence) | |
@name = name | |
@price = price | |
@recurrence = recurrence | |
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
#!/usr/bin/env ruby | |
%w(yaml ap).each { |dep| require dep } | |
obj = YAML::load(DATA) | |
ap obj | |
__END__ | |
boolean_true: Yes | |
boolean_false: No |
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
#!/usr/bin/env ruby | |
%w(yaml ap).each { |dep| require dep } | |
obj = YAML::load(DATA) | |
puts obj['paragraph'] | |
p "-"*30 | |
puts obj['line'] | |
__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
#!/usr/bin/env ruby | |
%w(yaml ap).each { |dep| require dep } | |
obj = YAML::load(DATA) | |
ap obj['countries'] | |
puts "-"*20 | |
ap obj['cities'] | |
__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
#!/usr/bin/env ruby | |
%w(yaml ap).each { |dep| require dep } | |
obj = YAML::load(DATA) | |
ap obj['test']['host'] | |
__END__ | |
development: &dev | |
host: localhost | |
user: username |
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
#!/usr/bin/env ruby | |
%w(yaml ap).each { |dep| require dep } | |
obj = YAML::load(DATA) | |
puts "-" * 30 | |
ap obj['firstName'] | |
puts "-" * 30 |
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
$ ruby poc_fiber.rb | |
"hello" | |
"world" |