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
-module(cards). | |
-export([make_deck/0, shuffle/1]). | |
make_deck() -> | |
[{Rank, Suit} || Rank <- ["A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K"], | |
Suit <- ["Clubs", "Diamonds", "Hearts", "Spades"]]. | |
shuffle(List) -> shuffle(List, []). | |
shuffle([], Acc) -> Acc; |
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(teeth). | |
-export([alert/1]). | |
-spec(alert(list(list(non_neg_integer()))) -> list(non_neg_integer())). | |
alert(PocketDepths) -> | |
check_pockets(PocketDepths). | |
check_pockets([Head | Tail]) -> |
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
export PYENV_ROOT="${HOME}/cache/.pyenv" | |
if [ -d ${PYENV_ROOT} ]; then (cd ${PYENV_ROOT}; git pull --rebase); else git clone https://github.com/yyuu/pyenv.git ${PYENV_ROOT}; fi | |
export PATH="${PYENV_ROOT}/bin:${PATH}" | |
eval "$(pyenv init -)" | |
pyenv install -s; echo 'lofasz' | |
pip install --upgrade pip setuptools | |
[ -f requirements.txt ] && pip install -r requirements.txt | |
[ -f requirements.development.txt ] && pip install -r requirements.development.txt |
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 |
NewerOlder