Skip to content

Instantly share code, notes, and snippets.

View benphelps's full-sized avatar
🇺🇦
Slava Ukrayini!

Ben Phelps benphelps

🇺🇦
Slava Ukrayini!
View GitHub Profile
module Cinch
module Plugins
class PluginWatcher
include Cinch::Plugin
def initialize(*args)
super
auto_reload_plugins
end
ri 'Array#<=>'
= Array#<=>
(from ruby site)
------------------------------------------------------------------------------
ary <=> other_ary -> -1, 0, +1 or nil
------------------------------------------------------------------------------
Comparison---Returns an integer (-1, 0, or +1) if this array is less than,
require 'spec_helper'
describe "account" do
context 'with no displayname' do
it 'can set display name' , :js => true, :slow => true do
end
class Wallet < ActiveRecord::Base
attr_accessible :cents, :margin_cents
belongs_to :user
def equity
margin + cash + user.stocks.mark_value
end #^
# \ This is what I need access to
end
1.9.3 (main):0 > numberize ['1','2.2','a', '-2']
=> [
[0] 1,
[1] 2.2,
[2] "a",
[3] -2
]
1.9.3 (main):0 > numberize ['1','2.2','a', '-2', '-2.2']
=> [
[0] 1,
1.9.3 (main):0 > a
=> [
[0] 1,
[1] "1",
[2] "1.1",
[3] "a",
[4] "-1",
[5] "-2.2"
]
1.9.3 (main):0 > b
@benphelps
benphelps / lighttpd.sh
Created December 1, 2012 16:38
Lighttpd Init Script
#!/bin/sh
### BEGIN INIT INFO
# Provides: lighted
# Required-Start: $syslog $remote_fs $network
# Required-Stop: $syslog $remote_fs $network
# Should-Start: fam
# Should-Stop: fam
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the lighted web server.
@benphelps
benphelps / lighttpd.conf
Created December 1, 2012 16:41
Lighttpd config file
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite"
)
server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
#!/usr/bin/perl -w
use strict;
open MIMETYPES, "/etc/mime.types" or exit;
print "mimetype.assign = (\n";
my %extensions;
while(<MIMETYPES>) {
chomp;
s/\#.*//;
next if /^\w*$/;
if(/^([a-z0-9\/+-.]+)\s+((?:[a-z0-9.+-]+[ ]?)+)$/) {
#!/bin/bash
echo "#####"
echo "Core System Setup"
echo "#####"
echo ""
read -p "Set MySQL Root Password: " mysqlrootpass
#