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 "bundler/capistrano" | |
require 'san_juan' | |
set :application, "myapp" | |
set :repository, "[email protected]:myapp.git" | |
set :scm, :git | |
set :user, 'deploy' | |
set :use_sudo, false | |
set :deploy_to, "/var/www/#{application}" |
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
namespace MyApp | |
{ | |
public class Installer : IWindsorInstaller | |
{ | |
public static Binding DefaultBinding | |
{ | |
get | |
{ | |
return new BasicHttpBinding | |
{ |
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
def check_signature | |
return if request.host == 'test.host' | |
# check signature | |
# ... | |
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
require 'net/http' | |
class MixpanelTrackEventJob | |
@queue = :slow | |
def self.perform(name, params, user_id, user_ip = nil) | |
user = User.find(user_id) | |
params.merge!({ :distinct_id => user.id, :mp_name_tag => user.email }) if !user.nil? | |
params.merge!({ :ip => user_ip }) if !user_ip.nil? |
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
<script type="text/javascript">var mpq=[];mpq.push(["init","<%= AppSettings.api_keys.mixpanel %>"]);(function(){var b,a,e,d,c;b=document.createElement("script");b.type="text/javascript";b.async=true;b.src=(document.location.protocol==="https:"?"https:":"http:")+"//api.mixpanel.com/site_media/js/api/mixpanel.js";a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(b,a);e=function(f){return function(){mpq.push([f].concat(Array.prototype.slice.call(arguments,0)))}};d=["init","track","track_links","track_forms","register","register_once","identify","name_tag","set_config"];for(c=0;c<d.length;c++){mpq[d[c]]=e(d[c])}})(); | |
</script> |
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
Resque.enqueue(MixpanelTrackEventJob, "Added CC Info", {:type => 'AMEX'}, current_user.id) |
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
curl -H "api_key: 87c66d340c0f4e938a32e039d0736a0f" https://www.thecloudblocks.com/api/v1/queue/879df17270704e27bbd3a6f4a6c0347c.json |
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
reg = /\${(?<key>.*?)}/ | |
text.gsub(reg) do | |
key = $~[:key] | |
"the replacement" | |
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
@pid_full = '/tmp/my_daemon.pid' | |
def run | |
EM.run{ | |
Signal.trap('INT') { stop } | |
Signal.trap('TERM'){ stop } | |
# your daemon code runs here. This will not exit since it is running in EM | |
} | |
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
// This goes in application.js | |
// Using this, the confirmation alerts on Rails 3.1 will be replaced with this behaviour: | |
// The link text changes to 'Sure?' for 2 seconds. If you click the button again within 2 seconds the action is performed, | |
// otherwise the text of the link (or button) flips back and nothing happens. | |
$.rails.confirm = function(message, element) | |
{ | |
var state = element.data('state'); | |
var txt = element.text(); | |
if (!state) |
OlderNewer