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
| function push_file() { | |
| file=$1 | |
| host=wherever.com | |
| pass=secret | |
| user=bau5 | |
| dir=dir_to_cdto | |
| ftp -invp $host<<ENDOFUPLOAD | |
| user $user $pass | |
| cd $dir |
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 ApplicationController < ActionController::Base | |
| around_filter :check_dry_run | |
| def check_dry_run | |
| ActiveRecord::Base.transaction do | |
| yield | |
| raise ActiveRecord::Rollback, "dry_run specified; no changes made" if @dry_run | |
| 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
| class CallFlow < ActiveRecord::Base | |
| belongs_to :routable, :polymorphic => true | |
| #validates_presence_of :dnis | |
| #validates_uniqueness_of :dnis | |
| def dialplan | |
| puts self.routable.description.squeeze("\n").strip | |
| end | |
| def target_route=(params) |
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 |
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
| 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
| <?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
| @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
| 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
| nested_attributes = validate_hash[:criteria].merge({ | |
| 'target_route' => { | |
| 'kind' => 'RouteByMessage', | |
| 'message_options_attributes' => { | |
| 'message' => 'blank', | |
| 'target_did' => ringto | |
| } | |
| } | |
| }).with_indifferent_access |