Skip to content

Instantly share code, notes, and snippets.

codingfoo /
Created Jan 8, 2021
Generate Reading list from a csv list of recomendations.
import csv
recs_column = HARD_MODE
name_column = 0
from constraint import *
problem = Problem()
codingfoo / README
Last active Jul 19, 2017
Proof of concept for Elixir add functions to a mock library in tests
1. To pull in functions from multiple Tests a different before_compile hook needs to be registered for each test module
2. To add mocks to multiple mock modules, a attribute needs to be set up for each mock
codingfoo / index.js
Created Feb 16, 2016
Template for nodjs http server
View index.js
var http = require('http'); // require is unique to nodejs
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
// Listen on port 8080, IP defaults to
codingfoo / monit-test
Last active Aug 29, 2015
Monit smoke test
View monit-test
check file alerttest with path /.nonexistent
if does not exist then alert
codingfoo /
Last active Aug 29, 2015
Script for deploying workers
#!/usr/bin/env sh
set -o nounset
set -o errexit
set -o pipefail
shopt -s nullglob
declare -a environments=("production" "staging" "development")
declare -a workers=(*.worker)
View sublime.json
"auto_complete_commit_on_tab": true,
codingfoo / README
Last active Dec 8, 2015
Bash script template
To perform a syntax check/dry run of your bash script run:
bash -n
To produce a trace of every command executed run:
bash -v
To produce a trace of the expanded command use:
codingfoo / deploy.rb
Created Mar 11, 2014
Rails 4 Capistrano 2 local assets precompile
View deploy.rb
namespace :deploy do
namespace :assets do
desc 'Run the precompile task locally and rsync with shared'
task :precompile, :roles => :app, :except => { :no_release => true } do
system("bundle check"); exit if $? != 0
system("RAILS_ENV=#{stage} bundle exec rake assets:precompile"); exit if $? != 0
servers = find_servers :roles => :web, :except => { :no_release => true }
run <<-CMD.compact
cp -- #{shared_manifest_path.shellescape} #{current_path.to_s.shellescape}/assets_manifest#{File.extname(shared_manifest_path)}

Learn a variety of programming paradigms:

  • Write a program in assembly language
  • Write an application in a functional language
  • Write an application in an object-oriented language
  • Write an application in a prototype-based language
  • Write an application in a logic programming language
  • Write an application using the Actor model
  • Write an application in Forth
codingfoo / boot.rb
Created Jan 20, 2014
Modify default rails server port
View boot.rb
require 'rails/commands/server'
module Rails
class Server
alias :default_options_alias :default_options
def default_options
default_options_alias.merge!(:Port => 3014)