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
| # Throw an exception when any of the following files/directories change to prevent autotest from running | |
| Autotest.add_hook :initialize do |at| | |
| %w{.svn .hg .git vendor rerun.txti db log tmp .DS_store Gemfile.lock}.each {|exception| at.add_exception(exception)} | |
| end |
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 Item | |
| attr_accessor :description, :completed | |
| def initialize desc | |
| @description = desc | |
| @completed = false | |
| end | |
| end |
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
| # lib/local_calling_guide.rb | |
| # This file should be autoloaded when Rails starts | |
| require 'rest_client' | |
| require 'xmlsimple' | |
| class LocalCallingGuide | |
| def initialize | |
| @url = "http://www.localcallingguide.com/xmllocalprefix.php" |
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
| nested_attributes = validate_hash[:criteria].merge({ | |
| 'target_route' => { | |
| 'kind' => 'RouteByMessage', | |
| 'message_options_attributes' => { | |
| 'message' => 'blank', | |
| 'target_did' => ringto | |
| } | |
| } | |
| }).with_indifferent_access |
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 CallFlow < ActiveRecord::Base | |
| establish_connection "callengine_#{Rails.env}" | |
| belongs_to :routable, :polymorphic => true | |
| def dialplan | |
| puts self.routable.description.squeeze("\n").strip | |
| end | |
| def target_route=(params) | |
| self.routable = params[:kind].constantize.new(params.reject {|k,v| k == "kind"}) |
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
| @parent_ou = OrganizationalUnit.where("api_key='#{@api_key}' and api_secret='#{@api_secret}' and master_node=1") | |
| #get first descendents of ou then find all of their children recursively | |
| children = @parent_ou.first.children | |
| ou_children = (children + children.map(&:children)).flatten | |
| #put the children ouid's in a new array | |
| @ous = Array.new | |
| ou_children.each do |child| | |
| @ous.push child.id |
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
| <?php | |
| $data = array ( | |
| "limit" => 5, | |
| "api_key" => 'YOUR_API_KEY', | |
| "api_secret" => 'YOUR_API_SECRET', | |
| ); | |
| $method = "getCallDetails"; | |
| $url = "https://api.logmycalls.com/services/$method"; | |
| $opts = array('http' => | |
| array( |
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 'json' | |
| require 'rest_client' | |
| # Requires: rest_client (gem install rest-client) | |
| class LmcApi | |
| def initialize | |
| @url = 'https://api.logmycalls.com/services' | |
| @auth = { |
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
| file=$1 | |
| server=server.com | |
| user=user | |
| pass=pass | |
| bucket=/uploads | |
| dl_location=http://host.com | |
| function push_file() { | |
| ftp -invp "$server"<<ENDOFUPLOAD | |
| user $user $pass |
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
| # http://projecteuler.net/problem=1 | |
| # | |
| # If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
| # | |
| # Find the sum of all the multiples of 3 or 5 below 1000. | |
| sum = 0 | |
| (1..999).each do |n| | |
| if n.modulo(5) == 0 || n.modulo(3) == 0 | |
| sum += n |