Skip to content

Instantly share code, notes, and snippets.

View poysama's full-sized avatar

poysama poysama

View GitHub Profile
@poysama
poysama / gist:2132563
Created March 20, 2012 07:42
mogilefsd usage file
∴ curl 10.48.30.26:7500/dev1
<html><head>
<title>/dev1</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type='text/css'>
table { width:100%; }
.name { text-align:left; }
.size, .mtime { text-align:right; }
.type { width:11em; }
.mtime { width:15em; }
@poysama
poysama / blocks_test.rb
Created November 27, 2012 06:44
improve method list
#!/usr/bin/env ruby
class Game
attr_accessor :name, :year, :system
attr_reader :created_at
def initialize(name, options={})
self.name = name
self.year = options[:year]
self.system = options[:system]
family "smith" do
mother "rose" do
age "60"
end
father "bob" do
age "65"
occupation "software developer"
end
@poysama
poysama / gist:5947716
Last active December 19, 2015 11:29
How do you access a class that is inside a module in another module without specifying its scope?
#!/usr/bin/env ruby
module AwesomeProject
module Models
class User
def intialize
end
end
end
end
# Nagions check_pm2 command
#
# define command {
# command_name check_pm2
# command_line $USER1$/check_pm2 --host=$HOSTADDRESS --name=translation_engine
#
# Nagios service example check for translation_engine
#
# define service{
# use tech-service
$VAR1 = bless( {
'_protocol' => 'HTTP/1.1',
'_content' => '{"status":-3,"appstatus":-128,"statusstring":"No connections.","appstatusstring":null,"results":[]}',
'_rc' => 200,
'_headers' => bless( {
'connection' => 'close',
'content-type' => 'application/json;charset=utf-8',
'client-response-num' => 1,
'server' => 'Jetty(7.6.1.v20120215)'
}, 'HTTP::Headers' ),
Cablefile
# REST source
source "http://10.48.30.75:5984/chronic/account"
# adjust template path
# default is config/templates
template_path 'config/templates'
# simple template
@poysama
poysama / testing
Last active August 29, 2015 14:06
testing
#!/usr/bin/env ruby
describe Adder do
before(:each) do
@adder = Adder.new
end
it "should add 2 numbers" do
expect { @added.add(1,2) }.to equal 3
end
### Given a configuration file for rails named app.yml which contains whatever dynamic content
# init.pp
class rails (
$configs = {},
) {
create_resources('rails::config', $configs, {})
}
define rails::config (