gem install rails
rails new my_app -T
Using during Hartl rails 4.0 guide (http://ruby.railstutorial.org/chapters)
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'
# 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. |
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) |
// 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 { |
// 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: [], |