Skip to content

Instantly share code, notes, and snippets.

View jubstuff's full-sized avatar

Giustino Borzacchiello jubstuff

View GitHub Profile
@jubstuff
jubstuff / hello_world.rb
Created September 1, 2011 08:08
Simple Hello World
def hello
puts "hello"
end
@jubstuff
jubstuff / array_w.rb
Created September 4, 2011 18:18
Creare un array in Ruby
a = %w{ uno due tre quattro }
@jubstuff
jubstuff / word_frequency.rb
Created September 5, 2011 13:36
Simple script that count the number of occurrences of a word in a string (from Programming Ruby 1.9)
# word_frequency.rb
#
# simple script that count the number of occurrences of a word in a string
#
#
def word_from_string(string)
#scan return an array of substring matching a given pattern
string.downcase.scan(/[\w']+/)
end
@jubstuff
jubstuff / queue.rb
Created September 5, 2011 13:41
Stack and Queue in Ruby using array
# queue.rb
#
# Using array as queue
#
# Combine use of push and shift
#
# =OUTPUT=
#
# $ ruby1.9.1 queue.rb
# ["one", "two", "three"]
// Hello world with Node.js
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
/* class implementation for javascript */
var Class = function(parent){
var klass = function(){
// call a function with a given _this_ argument and
// an array of arguments
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply
this.init.apply(this, arguments);
};
/*
* compile_directives.c
*
* Define a DEBUG macro that put the program in Development environment
*
* Use:
* gcc -Wall -DDEV_ENV compile_directives.c -o compile_directives.out
*
* Author: giustinob[a t]gmail.com
*
@jubstuff
jubstuff / pulire.php
Created April 5, 2012 09:32
ProgrammaZZione
$FORMS[document][1]["postsubmit_action"]="../../../modules/$_GET[modulo]/pages/$_GET[modulo]_show.php?id=$_GET[idriferimento]";//un pò sporco
" Vim color scheme based on http://github.com/jpo/vim-railscasts-theme
"
" Name: railscasts.vim
" Maintainer: Ryan Bates
" License: MIT
set background=dark
hi clear
if exists("syntax_on")
syntax reset
<?php
use Zend\Db\Sql\Select;
// basic table
$select0 = new Select;
$select0->from('foo');
// 'SELECT "foo".* FROM "foo"';