Skip to content

Instantly share code, notes, and snippets.

View hexorx's full-sized avatar

Josh Robinson hexorx

View GitHub Profile
def self.previous_cycle user, cycle = nil
cycle ||= Date.today
previous_cycle = find(:first, :select => 'distinct billed', :conditions => ['user_id = ? AND billed < ?', user, cycle], :order => 'billed DESC')
previous_cycle ? previous_cycle.billed : nil
end
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<IfTime start="0800" end="1700" tz="MTN">
<Tag>open</Tag>
<Tag class="anti">closed</Tag>
</IfTime>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Play loop="2">http://foo.com/cowbell.mp3</Play>
<Say voice="man" loop="4" language="en">Josh</Say>
<Gather action="/digit.php" method="GET" timeout="10" finishOnKey="4" numDigits="3">
<Say>Robinson</Say>
<Play>http://foo.com/cowbell.mp3</Play>
</Gather>
<Record action="http://foo.edu/handleRecording.php" method="GET" maxLength="20" finishOnKey="123*"/>
<Say voice="man" loop="4" language="en">Josh</Say>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Root -->
<xs:element name="Response">
<xs:complexType>
<xs:sequence>
<xs:group ref="Verbs" maxOccurs="unbounded"/>
<xs:choice>
<?xml version="1.0" encoding="UTF-8"?>
<document type="freeswitch/xml">
<section name="dialplan" description="Dialplan">
<context name="public">
<extension continue="true" name="user-active">
<condition field="${sip_h_x-user-status}" expression="^active$">
<anti-action application="info"/>
<anti-action application="hangup" data="MANAGER_REQUEST"/>
</condition>
</extension>
// Similar to the previous rule, however better detail in the reason message and quality-based disable times..
// Example reason message could be: Too much fail. Not enough successful connections. Excess PDD. Disabled for 12h.
number.count.total < 2 | break;
number.fail.percentage >= 20 | score -1, reason "Too much fail.";
number.timeout.percentage >= 20 | score -1, reason "Too many timeouts.";
number.ok.percentage < 50 | score -1, reason "Not enough successful connections.";
number.pdd.average > 8 | score -1, reason "Excess PDD.";
// Subrule syntax example - does not actually make sense as a production rule:
number.provider == 65 {
@include multi-shadow(0px 1px 2px 0px rgba(0, 0, 0, 0.296875) inset, 0px 1px 0px 0px rgba(255, 255, 255, 0.597656))
@mixin multi-shadow($shadow-1, $shadow-2: false, $shadow-3: false, $shadow-4: false, $shadow-5: false, $shadow-6: false, $shadow-7: false, $shadow-8: false, $shadow-9: false)
$full: $shadow-1
@if $shadow-2
$full: $full + "," + $shadow-2
@if $shadow-3
$full: $full + "," + $shadow-3
@if $shadow-4
$full: $full + "," + $shadow-4
@hexorx
hexorx / gist:1151639
Created August 17, 2011 14:38
homebrew beanstalkd formula patch for lion
def patches
"https://github.com/kr/beanstalkd/commit/976ec8ba8e70e3b5027f441de529f479c11c8507.patch"
end
@hexorx
hexorx / tmux.conf
Created April 2, 2012 18:24
tmux config
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
# Setting the delay between prefix and command
set -sg escape-time 1
# Ensure that we can send Ctrl-A to other apps

Testing Gist.io

Could be useful. I wonder if it could be used for blog blogs. The general idea is pretty cool.