Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript" src="http://i0.poll.fm/survey.js" charset="UTF-8"></script>
<noscript><a href="http://polldaddy.com/s/how-do-you-like-new-home-tours">Take Our Survey!</a></noscript>
<script type="text/javascript">
polldaddy.add( {
type: 'button',
title: 'Take Our Survey!',
style: 'inline',
id: '8EF3172A8164D399'
} );
</script>
<!-- Begin MailChimp Signup Form -->
<link href="http://cdn-images.mailchimp.com/embedcode/classic-081711.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="http://trnk-newyork.us4.list-manage1.com/subscribe/post?u=83d31755b5a57f780de73da26&amp;id=ea579a7f52" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<h2>Subscribe to our mailing list</h2>
@roneesh
roneesh / gist:6136696
Last active December 20, 2015 13:09
Exercise 1 from Exercism.io - Bob Bob answers 'Sure.' if you ask him a question. He answers 'Whatever.' if you tell him something. He answers 'Woah, chill out!' if you yell at him (ALL CAPS). He says 'Fine. Be that way!' if you address him without actually saying anything.
# Where I ended up...
class Bob
def hey input
talking = Phrase.new(input)
return 'Fine. Be that way.' if talking.silent?
return 'Woah, chill out!' if talking.yelling?
@roneesh
roneesh / gist:6136677
Created August 2, 2013 00:46
RNA Transcription problem from exercism.io Write a program that can translate a given DNA string to the transcribed RNA string corresponding to it. An RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'. Given a DNA string t corresponding to a coding strand, its transcribed RNA string u is formed by replacing all oc…
# Where I ended up...
class DNA < String
def to_rna
tr('T','U')
end
end
@roneesh
roneesh / gist:6136641
Last active December 20, 2015 13:09
The Exercism.io word-count problem: Write a program that given a phrase can count the occurrences of each word in that phrase. For example for the input `"olly olly in come free"` ```plain olly: 2 in: 1 come: 1 free: 1 ```
# Where I ended up...
class Phrase < String
def word_count
words.each_with_object(Hash.new(0)) { |word, word_count| word_count[word] += 1 }
end
def words
downcase.scan(/\w+/)
.two-column {
-moz-column-count: 2; /* Firefox */
-webkit-column-count: 2; /* Safari and Chrome */
column-count: 2;
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
column-gap:40px;
}
The stack:
OS
Web server
application server
database server
more.... (caching, any tools to keep an up and running)
A fresh rails development stack:
Mac OSX - WEBrick - SQLite
<%= form_for [@user, @project] do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@project.errors.count, "error") %> prohibited this project from being saved:</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://www.zurb.com/playground/javascripts/plugins/jquery.annotate.js"></script>
<style type="text/css">
.black {
background: black;
height: 5px;
width: 5px;
@roneesh
roneesh / FizzBuzz.rb
Created December 4, 2012 08:26
A solution of the classic FizzBuzz problem
#FIZZ BUZZ
#Counts up from 1 to 100
#puts 'fizz' if the number is divisible by 3
#puts 'buzz' if the number is divisible by 5
#puts 'fizzbuzz' if the number is divisible by 3 and 5
(1..100).each do |number|
if (number % 3 == 0) && (number % 5 == 0)