Skip to content

Instantly share code, notes, and snippets.

vaz vaz

Block or report user

Report or block vaz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
vaz / js-function-declarations.js
Created Oct 16, 2012
Javascript function declaration tutorial
View js-function-declarations.js
> // There are two different ways to define functions in javascript.
> // Functions can be named, or anonymous.
> // The named function syntax looks more like a C- or Java-style "statement":
> function f(){ }
> // Notice it evaluates to "undefined". I'll come back to this in a sec.
> // The named function syntax binds the function to a local variable with the given name.
> f
[Function: f]
> // It also actually names the function object:
vaz / vaz-sorting.cpp
Created Oct 18, 2012
Timed trials of selection, merge and quick sort.
View vaz-sorting.cpp
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
typedef void (*sorting_fun)(int[], int);
vaz / closures-tut.js
Last active Dec 14, 2015
Some example and semi-pseudo tutorial code showing using closures for chaining animations.
View closures-tut.js
// the self-calling function is a
// Javascript "module" pattern for
// not leaking stuff into global scope:
// simple closure example
function loglater(message){
return function logger(){
console.log(message); // references outer function's argument
vaz / euler-primes.rb
Created Sep 1, 2014
Euler problem, prime factorization
View euler-primes.rb
# find primes up to n
def sieve(n)
return n if n == 2
s = (3..n).step(2).to_a
s.each { |i| s.reject! { |j| j != i && j % i == 0 } }
def new_sieve(n)
(s = maybe_primes(n)).each { |i| s.reject! { |j| j != i && j % i == 0 } }
vaz / SassMeister-input.scss
Created Feb 16, 2015
Generated by
View SassMeister-input.scss
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
// We use these functions to define ranges for various things, like media queries.
@function lower-bound($range){
@if length($range) <= 0 {
@return 0;
vaz /
Created Dec 23, 2015
Bash script to toggle showing hidden files in Finder
showAllFiles ()
local new old=`defaults read AppleShowAllFiles`;
if [ "$old" = "TRUE" ]; then
defaults write AppleShowAllFiles $new;
echo -n " AppleShowAllFiles = ";
vaz / bash-log.txt
Created Apr 22, 2016
testing old-darwin-fallback branch of Listen (PR)
View bash-log.txt
$ bash
This is what happens now. Simple Gemfile:
source ''
gem 'listen'
Updating bundle...
Fetching gem metadata from
Fetching version metadata from
Fetching dependency metadata from
Resolving dependencies...
vaz / 1 - Intro to HTTP - Lecture
Last active May 16, 2016
intro-to-http (Van-Web-Apr25) [2016-05-16]
View 1 - Intro to HTTP - Lecture

Intro to HTTP

Here are the lecture notes from May 16, 2016: Intro to HTTP

What is HTTP

HTTP is Hyper-Text Transfer Protocol.

OK, What is Hyper-Text?

vaz / sinatra-sessions.rb
Created May 16, 2016
Sinatra sessions example
View sinatra-sessions.rb
# basic sinatra app showing some use of sessions to handle
# some (insecure) authentication
require 'sinatra'
# enable default sessions support
# sessions are "like hashes" and get serialized (stringified) and
# stored directly in a session cookie.
# Sinatra (actually a Rack sessions extension) handles this for you
enable :sessions
vaz /
Last active Jun 23, 2016
Lighthouse Labs - Breakout on Acceptance Testing with Capybara (2016-05-18)

Acceptance Testing

2016-05-18 breakout by Vaz

This breakout covered:

  • Using RACK_ENV in the conventional way to use a different db for development than for tests
  • Adding RSpec to the skeleton with a (very) basic model spec
  • Introduction to acceptance testing and Capybara, focusing on form submission for creating new records
You can’t perform that action at this time.