Skip to content

Instantly share code, notes, and snippets.

View letladi's full-sized avatar

Letladi Sebesho letladi

View GitHub Profile
@letladi
letladi / blocks_foundations.md
Created August 13, 2016 05:18 — forked from zlw5009/blocks_foundations.md
An article on Ruby Blocks and Procs

Building a Foundation with &blocks

What is a Block?

Blocks... What are they anyway? You've probably used them without even realizing it and most certainly have seen them, but do you know what they are?

If we wanted to take a simplistic approach at defining a block we could say:

A block is a chunk of code contained within the do..end or { curly braces } syntax that is to be executed at some point in time.

With that being said, if you've ever used the Enumerable#map or Enumerable#each method, you've probably used a block. Lets take a look at two different types of blocks before we go into more detail about what a block really is.

@letladi
letladi / .vimrc
Created April 15, 2016 20:12 — forked from jeresig/.vimrc
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
@letladi
letladi / csvParser.js
Last active August 29, 2015 14:25
Simple Node.js CSV Parser module that returns a collection of objects
var fs = require('fs');
function csvParser(filePath) {
fs.readFile(filePath, 'utf8', function(err, data) {
if (err) {
throw err;
} else {
var result = [];
var lines = data.split('\n');
var headings = lines[0].split(',');