Skip to content

Instantly share code, notes, and snippets.

Avatar

Kris Kovalik nu7hatch

View GitHub Profile
View setup.js
var fillSocialCounters = function() {
$('a.socialBtn').fillSocialCounter()
}
$(document).ready(function() {
var text = $('.post h1.title').text()
, url = document.location.href
$('a[rel="facebook"]').facebookButton({ text: text, url: url })
$('a[rel="twitter"]').twitterButton({ text: text, url: url, via: "nu7hatch" })
View bench
chris@abyss · 1.9.3 · /tmp/bench_list
$ time go run slice.go
real 0m0.858s
user 0m0.732s
sys 0m0.112s
chris@abyss · 1.9.3 · /tmp/bench_list
$ time go run list.go
real 0m1.556s
View hashifiable.rb
module Hashifiable
def hashify(*args)
hashified = {}
args.each do |arg|
case arg
when Symbol
hashified[arg] = lambda { |obj| obj.send(arg) }
when Hash
arg.each do |key, proc|
@nu7hatch
nu7hatch / _utils.bash
Last active Dec 18, 2015
Bash utilities for setup scripts.
View _utils.bash
# _utils.bash --- Utilities used across all the scripts.
ERROR_FILE="/tmp/setup_script_error.msg"
# Checks if user has cowsay installed, and if it does
# then uses it to display the message.
cowsay_or_echo()
{
cowsay=`which cowsay`
cowsay_eyes=$1; shift
View gist:5700037
int numberOfSheeps = 0;
for (; numberOfSheeps < sheeps.length; numberOfSheeps++) {
if (me.asleep) break;
}
@nu7hatch
nu7hatch / _utils.bash
Created Apr 15, 2013
Utilities for setup scripts.
View _utils.bash
# _utils.sh --- Utilities used across all the scripts.
set -e
set -o pipefail
# Prints spaces as a prefix to the command's output.
function prefixed {
sed -e "s/^/ /"
}
@nu7hatch
nu7hatch / vagrant.md
Created Oct 30, 2012
Vagrant boxes
View vagrant.md

What is Vagrant? It's a neat command line interface and toolchain at top of VirtualBox, which allows you to create and manage virtual "boxes" - vm instances with stuff configured for your project.

Why is it awesome?

Because you don't have to setup everything for the project every time when hop in, you do it once using one of the base boxes, you package it and populate *.box file across all project members. When you need to add some software (new database, cache soft, etc), you just have to add it once, and ping everyone to update their boxes. Briliant, isn't it?

It works great also with designers and non-technical people, download and setup of a box takes few minutes and they don't have to polute their machines with all the project related software.

Above all, no more excuses "works for me", or "works on development, but not on the production" - as boxes are made to simulate production environment as much as possible.

View ab-golang-egoist
› ab -n 20 -c 4 'http://localhost:8000/count.js?url=http://desantapp.com/&n=facebook,twitter,plusone&cb=hello'
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software:
@nu7hatch
nu7hatch / Vagrantfile
Created Jul 22, 2012
Default Vagrantfile
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "app-name"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://host.com/boxes/app-name.box"
View gist:1584599
▸ make VERBOSE=true
/usr/local/Cellar/cmake/2.8.4/bin/cmake -H/Users/cubox/code/kosmonaut -B/Users/cubox/code/kosmonaut/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/2.8.4/bin/cmake -E cmake_progress_start /Users/cubox/code/kosmonaut/build/CMakeFiles /Users/cubox/code/kosmonaut/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make -f CMakeFiles/kosmonaut.dir/build.make CMakeFiles/kosmonaut.dir/depend
cd /Users/cubox/code/kosmonaut/build && /usr/local/Cellar/cmake/2.8.4/bin/cmake -E cmake_depends "Unix Makefiles" /Users/cubox/code/kosmonaut /Users/cubox/code/kosmonaut /Users/cubox/code/kosmonaut/build /Users/cubox/code/kosmonaut/build /Users/cubox/code/kosmonaut/build/CMakeFiles/kosmonaut.dir/DependInfo.cmake --color=
Dependee "/Users/cubox/code/kosmonaut/build/CMakeFiles/kosmonaut.dir/DependInfo.cmake" is newer than depender "/Users/cubox/code/kosmonaut/build/CMakeFiles/kosmonaut.dir/depend.internal".
Dependee "/Users/cubox/code/kosmonaut/build/CMakeFiles/CMake