Skip to content

Instantly share code, notes, and snippets.

@codingfoo
codingfoo / constrain.py
Created Jan 8, 2021
Generate Reading list from a csv list of recomendations.
View constrain.py
import csv
HARD_MODE = 2
NORMAL_MODE = 3
recs_column = HARD_MODE
name_column = 0
from constraint import *
problem = Problem()
@codingfoo
codingfoo / README
Last active Jul 19, 2017
Proof of concept for Elixir add functions to a mock library in tests
View README
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
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 127.0.0.1
server.listen(8080);
@codingfoo
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
codingfoo / iron-worker-deploy.sh
Last active Aug 29, 2015
Script for deploying iron.io workers
View iron-worker-deploy.sh
#!/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,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
@codingfoo
codingfoo / README
Last active Dec 8, 2015
Bash script template
View README
To perform a syntax check/dry run of your bash script run:
bash -n myscript.sh
To produce a trace of every command executed run:
bash -v myscripts.sh
To produce a trace of the expanded command use:
@codingfoo
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)}
CMD
View programming-achievements.md

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
codingfoo / boot.rb
Created Jan 20, 2014
Modify default rails server port
View boot.rb
#config/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)
end
end