Skip to content

Instantly share code, notes, and snippets.

@libryder
libryder / 1-before.css.scss
Last active December 11, 2015 23:18
Cleaning up a sass file
#report-summary {
.clear { clear: both; }
border: 1px solid #ddd;
border-radius: 5px;
padding: 10px;
.summary-report {
}
-rw-r--r-- 1 cylon staff 985 Jan 23 15:00 Gemfile
-rw-r--r-- 1 cylon staff 8782 Jan 23 15:00 Gemfile.lock
-rw-r--r-- 1 cylon staff 1709 Jan 19 21:51 README.md
-rw-r--r-- 1 cylon staff 280 Jan 12 12:42 Rakefile
drwxr-xr-x 11 cylon staff 374 Jan 18 09:47 app
drwxr-xr-x 11 cylon staff 374 Jan 23 14:58 config
-rw-r--r-- 1 cylon staff 165 Jan 12 12:42 config.ru
drwxr-xr-x 5 cylon staff 170 Jan 18 15:56 db
drwxr-xr-x 3 cylon staff 102 Jan 12 12:42 doc
drwxr-xr-x 5 cylon staff 170 Jan 19 17:21 lib
@libryder
libryder / style.html
Created January 16, 2013 23:21
Easily align form fields with their labels
<div>
<div style="width: 200px">
Title
</div>
<div style="float:left">
[text field]
</div>
<div style="clear:both"></div>

A man sat at a metro station in Washington DC and started to play the violin; it was a cold January morning. He played six Bach pieces for about 45 minutes. During that time, since it was rush hour, it was calculated that 1,100 people went through the station, most of them on their way to work.

Three minutes went by, and a middle aged man noticed there was musician playing. He slowed his pace, and stopped for a few seconds, and then hurried up to meet his schedule.

A minute later, the violinist received his first dollar tip: a woman threw the money in the till and without stopping, and continued to walk.

/* Martin Vit [email protected]
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2.
*/
/*
This unit reads and parse packets from network interface or file
and insert them into Call class.
*/
@libryder
libryder / instructions.txt
Created September 27, 2012 22:14
Installing unimrcp with asterisk 1.8 and cepstral 6
Instructions found here:
http://code.google.com/p/unimrcp/wiki/InstallationGuide and
http://code.google.com/p/unimrcp/wiki/CepstralPlugin
1) Get source:
svn checkout http://unimrcp.googlecode.com/svn/trunk/ unimrcp
2) Install
./bootstrap
./configure --with-swift=/opt/swift --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr
@libryder
libryder / ahn_dial.rb
Created September 21, 2012 03:08
Manually play audio to receiver in Adhearsion
def dial_out(did, callerid, options)
dial_string = "SIP/#{TRUNK}/#{did},,#{options}"
execute "Dial", dial_string
end
#...
dial_out(did, callerid, 'A(whisper)')
def has_coords_for_client?(client)
client_area_location = client_are_location_for_client(client)
return true if self.has_coords? || (client_area_location.has_coords? if client_area_location)
return false
end
def client_area_location_for_client(client)
client_area_locations = client_area_locations.where(:id => client.id)
client_area_locations.first if client_area_locations
end
def some_method
if some_conditional
some_sql_query
else
nil
end
end
if some_method.nil?
perform_some_action
@libryder
libryder / my_controller_spec.rb
Created August 31, 2012 19:44
Testing call controllers in Adhearsion 2.0
# encoding: utf-8
require 'spec_helper'
describe MyController do
let(:mock_call) { mock 'Call', :to => '1112223333', :from => "2223334444" }
let(:metadata) { {} }
subject { MyController.new(mock_call, metadata) }
it "should have empty metadata" do