Skip to content

Instantly share code, notes, and snippets.

@domitry
domitry / index.md
Last active August 29, 2015 14:00
GSoC 2014 proposal version 3

SciRuby D3 project

Introduction

We have come up with an approach for the SciRuby D3 GSoC. Basically we decided that for interactive visualisations generating Javascript from Ruby is not the way forward. The clue is already in the D3 name, i.e., data driven documents ;)

What we are proposing is to create the visualisations as pure Javascript components. Components are driven by data in the form of JSON. Components are

@orend
orend / functional.rb
Last active August 8, 2023 05:52
further refactoring to "Using a Ruby Class To Write Functional Code" - http://patshaughnessy.net/2014/4/8/using-a-ruby-class-to-write-functional-code
# Added: Line#to_s, #parse4, #parse5
class Line
attr_reader :Line
def initialize(text)
@line = text
end
@prefix : <http://www.rqtl.org/ns/#> .
@prefix qb: <http://purl.org/linked-data/cube#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix prop: <http://www.rqtl.org/dc/properties/> .
@prefix cs: <http://www.rqtl.org/dc/cs/> .
:dsd-mr a qb:DataStructureDefinition;
qb:component cs:refRow ,
cs:chr ,
@igrigorik
igrigorik / drive-appscript.js
Last active September 30, 2021 13:58
Sample BigQuery queries for the HTTP Archive dataset.
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Run Query", functionName: "runQuery"} ];
ss.addMenu("HTTP Archive + BigQuery", menuEntries);
}
function runQuery() {
var projectNumber = 'httparchive';
var sheet = SpreadsheetApp.getActiveSheet();
@seki
seki / drb.rb
Created June 5, 2013 13:32
1st druby. [ruby-list:15406]
drb.rb
#!/usr/local/bin/ruby
=begin
Tiny distributed Ruby --- dRuby
DRb --- dRuby module.
DRbProtocol --- Mixin class.
DRbObject --- dRuby remote object.
DRbConn ---
DRbServer --- dRuby message handler.
=end
@xxuejie
xxuejie / geometries.js
Last active March 17, 2020 13:50
Webruby code vs JavaScript code, both use three.js
// The original JS code for WebGL geometries example in three.js repository
// I only changed the order of the functions for better comparison
// with the Ruby version.
// You can still find the original version inline at http://mrdoob.github.com/three.js/examples/webgl_geometries.html
var container, stats;
var camera, scene, renderer;
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
@rklemme
rklemme / matrix.rb
Last active December 12, 2015 12:19
Sample matrix with abstraction of rows and columns. This can certainly be improved, it's just to convey an idea.
#!/usr/bin/ruby
class Matrix
def initialize(row_headers, col_headers)
@row_headers = row_headers
@col_headers = col_headers
end
def [](row, col)
function smsInboundCallback (req, res) {
console.log('smsInboundCallback', req.body);
// { AccountSid: 'AC64065c2140fe4bf6849b13316fe1847a',
// ApiVersion: 'v1',
// Body: 'Oh hai',
// From: '+18012101024',
// SmsSid: 'SMa4bfb6db0a10413bad796d33ca0dcadf',
// SmsStatus: 'sent',
// To: '+12676708074' }