Skip to content

Instantly share code, notes, and snippets.

View balinterdi's full-sized avatar
👌
Enjoying life, including work.

Balint Erdi balinterdi

👌
Enjoying life, including work.
View GitHub Profile
# require 'memprof'
class Dumb
@@big_dumb_array = []
def initialize
@@big_dumb_array << [0] * 100_000
end
end
if __FILE__ == $0
<!DOCTYPE HTML>
<html>
<head>
<title>Tea timer</title>
<style type="text/css">
#timer {
margin: 50px auto;
text-align: center;
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}
class Object
def wood?
if self.to_s =~ /^wood$/i
"Yep, it's wood."
else
"No, it's #{self.to_s}."
end
end
end
var w = Ti.UI.currentWindow,
Bubbles = Ti.App.Bubbles;
var DescribePage = {
taxonomyController: function({
view: Ti.UI.createTableView({}),
// handle different kind of changes (changeGender, changeCategory, etc.) here?
})(),
createRowForTaxonomyClass: function(klass, value) {
var row = Ti.UI.createTableViewRow();
We couldn’t find that file to show.
(defn fibo [n]
(cond
(= n 0) 0
(= n 1) 1
:else (+ (fibo (dec n)) (fibo (- n 2)))))
(defn fibo-toc [n]
(letfn [(fib
[current next n]
(if (zero? n)
@balinterdi
balinterdi / roman_nums.clj
Created January 20, 2011 17:29
Roman numerals
(ns clojure_exercises.roman_nums
; (:use '[clojure.contrib.math :as math])
(:use clojure.test))
(defn roman-nums
([x]
(if (>= x 4000)
nil
(roman-nums x 0 [])))
([x pos res]
Address = function(options) {
this.city = options.city || 'Budapest';
this.country = options.country || 'Hungary';
this.street = options.street || 'Szep utca';
this.summary = function() {
return this.street + ', ' + this.city + ', ' + this.country + ' (' + this.type + ')';
};
}
Object.create = function(o) {
* Besides that we're Ruby fans and we actively use Ruby for a lots of things why should we use Ruby and Rails besides server-side Javascript frameworks (like node.js)? Will we benefit anything if we keep on using Rails or should we move to a language/tool that is common to clients and servers too?
* is there any way to easily represent / transform our models (validations / associations / etc.) to client side? (besides Backbone.js)
* why sproutcore?
* what works for inspiration? step away from your desk, walking, sleeping?
* do you miss ruby?
* how consistent are you doing testing-development cycles? are you a purist applying bdd, agile methodologies or do you have your own rituals you can share?
qsort = (coll) ->
if coll.length <= 1
coll
else
less = []
more = []
idx = Math.floor(Math.random() * coll.length)
pivot = coll.splice idx, 1
for elt in coll
if elt < pivot[0] then less.push(elt) else more.push(elt)