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
resources :concepts do | |
resources :watches do | |
collection do | |
delete 'index' | |
end | |
end | |
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
class HashWithMethod < Hash | |
def self.from(hash) | |
instance = self.new | |
hash.symbolize_keys.each do |key, value| | |
case value | |
when Hash | |
value = self.from(value) | |
when Array | |
value = value.map { |v| from_any(v) } |
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 ConfigLoader | |
def self.from(yaml) | |
yaml = File.read(yaml) if File.exist?(yaml) | |
YAML.load(ERB.new(yaml).result)[Rails.env] | |
end | |
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
#!/bin/bash | |
LOCK_FILE=/opt/var/db/mongodb/mongod.lock | |
PID_FILE=/var/run/mongo.pid | |
DAEMON=/opt/mongodb/bin/mongod | |
DBPATH=/opt/var/db/mongodb | |
mongo_running=0 | |
if [ -f $PID_FILE ]; then |
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
window.fluid.dockBadge = ''; | |
setTimeout(updateDockBadge, 1000); | |
setTimeout(updateDockBadge, 3000); | |
setInterval(updateDockBadge, 5000); | |
function updateDockBadge() { | |
var newBadge = ''; | |
var totalCount = 0; | |
var roomsRoot = document.getElementById('cw_roomlist_items'); | |
var ur_elms = roomsRoot.getElementsByClassName('cw_unread'); |
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
# place this file under Rails.root/config/initializers/configuration.rb | |
# | |
# load configurations from Rails.root/config/environments. | |
# | |
# load order is: | |
# 0. application.rb | |
# 1. #{Rails.env}.rb | |
# 2. app(1|2).rb | |
# 3. app(1|2)_#{rails.env}.rb | |
# 4. app(1|2)_local.rb |
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/ruby | |
require 'tempfile' | |
require 'open-uri' | |
require 'rubygems' | |
require 'sanitize' | |
require 'nokogiri' | |
webloc = ARGV[0] |
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 DigKey | |
constructor: (@catch_elm, @disp_elm, @form_elm) -> | |
$(@catch_elm).keydown (event) => | |
kc = event.keyCode | |
$(@disp_elm).append dig(kc) if is_num(kc) | |
if is_cr(kc) | |
$(@form_elm).submit | |
else | |
$(@disp_elm).append '<br/>' if is_cr(kc) |
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
window.fluid.dockBadge = ''; | |
setTimeout(updateDockBadge, 1000); | |
setTimeout(updateDockBadge, 3000); | |
setInterval(updateDockBadge, 5000); | |
function updateDockBadge() { | |
var newBadge = ''; | |
var totalCount = 0; | |
var badgesRoot = document.getElementById('wk-notifications'); |
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 EAN | |
valid_code: (ean) -> | |
return false if ean.match(/[^0-9]/) | |
ean += '00000' if ean.length == 8 | |
return false unless ean.length == 13 | |
return ean if is_valid(ean) | |
[ean[1], ean[0]] = [ean[0], ean[1]] | |
return ean if is_valid(ean) | |
false |