using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz && mkdir vim && tar xzf vim.tar.gz -C vim && export PATH=$PATH:/app/vim/bin |
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
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
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 | |
protect_from_forgery | |
before_filter do | |
# Find Account_ID by seach for a domain - NOT Refactored yet | |
host_id = $memcache_instance.get('hosts/' + request.host) | |
unless host_id | |
host_db_row = BimbooHost.where( :host => request.host ).one | |
if host_db_row | |
$memcache_instance.set('hosts/' + request.host, host_db_row.bimboo_account_id, 60*60) |
#####Copied from askubuntu's Enabling mic mute button and light on Lenovo Thinkpad
There are two possible "hardware" indicators (to show that mute is on or off):
The Power button light (green) will blink to show when mute is on The Mic mute button light (orange) will be on or off to show mute status (just like in Windows)
Solution 2 requires a patched thinkpad_acpi
kernel module, and is only recommended for advanced users who know what they are doing. This is because the patch is not included by the thinkpad_acpi
developers by default, (See this discussion for more details).
###Common Steps
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
module Tire | |
module Disable | |
module ClassMethods | |
def mock_es_response_doc | |
@mock_es_response_doc ||= | |
'{"took": 1,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed": 0},"hits": {"total": 0,"max_score": null,"hits": []}}' | |
end | |
def enable! &blk | |
old_enabled = @tire_enabled || false |
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
simpleFormat = (text) -> | |
re1 = /\r\n?/g | |
re2 = /\n\n+/g | |
re3 = /([^\n]\n)(?=[^\n])/g | |
fstr = text | |
fstr = fstr.replace(re1, "\n") # \r\n and \r -> \n | |
fstr = fstr.replace(re2, "</p>\n\n<p>") # 2+ newline -> paragraph | |
fstr = fstr.replace(re3, "$1<br/>") # 1 newline -> br | |
"<p>#{fstr}</p>" |
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
namespace :db do | |
desc 'Drop all database connections' | |
task :drop_connections => :environment do | |
database = Rails::Application.config.database_configuration[RAILS_ENV]["database"] | |
field = if ActiveRecord::Base.connection.send( :postgresql_version ) < 90200 | |
'pg_stat_activity.procpic' # PostgreSQL <= 9.1.x | |
else | |
'pg_stat_activity.pid' # PostgreSQL >= 9.2.x | |
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
=begin | |
Copyright (c) 2012, Nathaniel Ritmeyer | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. |
NewerOlder