Skip to content

Instantly share code, notes, and snippets.

View abner's full-sized avatar

Ábner Silva de Oliveira abner

View GitHub Profile

Install Rails 3.1

gem install rails

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@abner
abner / install.md
Last active August 29, 2015 14:07 — forked from JanDintel/install.md

Install Cucumber with Rspec, Guard, Factory Girl(?) and Spork

Using during Hartl rails 4.0 guide (http://ruby.railstutorial.org/chapters)

Gems

group :development, :test
  gem 'guard-rspec'
  gem 'guard-livereload'
  gem 'spork-rails', github: 'sporkrb/spork-rails' # rubygems version not rails 4 compatible
  gem 'guard-spork'
@abner
abner / frontend.rb
Last active August 29, 2015 14:06 — forked from migane/gist:3776032
jruby frontend
# Using MigLayout as frankly Javax Swing without a decent GUI
# tool is really a nightmare
# One has to download the MigLayout jar from its site
# then put it inside the jruby/lib folder
require 'java'
# For rvm users => allow to just run jruby frontend.rb
# provided that a .rvmrc has been created in the directory where
# frontend.rb is located.
@abner
abner / index.js
Created August 27, 2014 12:15 — forked from davidguttman/index.js
requirebin sketch
var through = require('through')
var streamVis = require('stream-vis')
// This is the readable stream
// "through" is a easy way of creating a readable (and writable) stream
var stream = through()
setInterval(function(){
stream.emit('data', new Date)
}, 500)
@abner
abner / index.js
Created August 27, 2014 12:10
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
module Sequel
module JDBC
module Oracle
class Dataset < JDBC::Dataset
# this, of course, brings the entire CLOB into memory (perhaps that is what we want)
def read_clob(clob)
# what about converting it to a Ruby IO object, as in:
# Java.java_to_ruby(org.jruby.RubyIO.new(JRuby.runtime, clob.getCharacterStream()).java_object)
reader = java.io.BufferedReader.new(clob.getCharacterStream())
require 'rubygems'
require 'sinatra'
require 'net-ldap'
require 'digest/sha1'
require 'base64'
require 'haml'
LDAP_HOST = 'localhost'
ADMIN_DN = 'cn=admin,dc=company,dc=com'
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Burndown Chart</title>
<style>
.chart {
border: 1px solid black;
}
.chart div {
@abner
abner / pso.js
Created March 11, 2014 11:58 — forked from adrianseeley/pso.js
// based on http://msdn.microsoft.com/en-us/magazine/hh335067.aspx
// usage example at bottom
function pso (number_of_dimensions, function_to_optimize, number_of_particles, number_of_iterations, fitness_threshold, inertia_weight, cognitive_weight, social_weight) {
var particles = [];
var swarm_best_position = [];
var swarm_best_fitness = null;
for (var p = 0; p < number_of_particles; p++) {
particles.push({
particle_position: [],

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname