Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

RomyRomy syntacticsugar

🎯
Focusing
View GitHub Profile
@syntacticsugar
syntacticsugar / gist:1587748
Created Jan 10, 2012
(l.i.v.i.n.g) (s.o.c.i.a.l) part 2 response
View gist:1587748

Sae Rom Hong

Open Source Tech Evangelist / Front End Designer How to Fall in Love with the Command Line

Imagine a mythical forest. This is a forest that at first, exists only in the invisible nth-dimension of your imagination. Just like Peter Pan's Neverland. This forest is the world of the Linux/Unix command line, and everything is enshrouded in a thick, black, darkness. The only remnants of light glow and flicker between walls of forward slashes, glittering periods, and blinking cursors.

Deep inside the forest hides an elusive silver unicorn. The unicorn flits in and out, behind thick trunks of trees, a hint of a mane trailing in the darkness. You have heard a rumor that it is possible to catch a glimpse of this unicorn, if you use a little “magic”.

@syntacticsugar
syntacticsugar / .DS_Store
Created Feb 22, 2012
Veggie Festival - a light Sinatra foray
@syntacticsugar
syntacticsugar / huffman.py
Created Aug 4, 2012 — forked from ryanwitt/huffman.py
silly huffman coding example
View huffman.py
__all__ = (
'build',
'endode',
'decode',
)
phrase = 'A man a plan a canal Panama'.lower()
def build(phrase):
"""
@syntacticsugar
syntacticsugar / gist:3722018
Created Sep 14, 2012
attempting to stall game with bundler and ashton
View gist:3722018
Death-Lair-of-Killer-Bambi:blobs stickycake$ bundle install
Fetching gem metadata from http://rubygems.org/....
Using gosu (0.7.45)
Using opengl (0.8.0.pre1)
Using ashton (0.0.1alpha) from git://github.com/Spooner/ashton.git (at master) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/stickycake/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating extconf.h
creating Makefile
@syntacticsugar
syntacticsugar / crapload_of_data.sql
Created Oct 8, 2012
Learn SQL Hard Way - snippets
View crapload_of_data.sql
INSERT INTO pet (id, name, breed, age, dead)
VALUES (5, "shimmer", "unicorn", 500, 1);
INSERT INTO pet (id, name, breed, age, dead)
VALUES (6, "water bottle", "faun", 4, 1);
INSERT INTO pet (id, name, breed, age, dead)
VALUES (7, "luis", "elephant", 282, 1);
INSERT INTO pet (id, name, breed, age, dead)
@syntacticsugar
syntacticsugar / Gemfile
Created Oct 16, 2012 — forked from fairchild/Gemfile
An example sinatra omniauth client app
View Gemfile
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
gem 'thin'
@syntacticsugar
syntacticsugar / mvc_summary.md
Created Oct 17, 2012
topfunky/peepcode's "16 Ruby on Rails Solid Workflow Tips"
View mvc_summary.md

http://www.codercaste.com/2011/02/11/10-ruby-on-rails-3-tips-that-will-make-you-a-better-rails-programmer/

Understand What a Model, Controller, View, and Helper are

Rails heavily depends on the model view controller (MVC) design pattern. Every one of them has a specific job and jeopardizing them is never a good idea. A controller is responsible for handling Rails requests and passing data from a model to a view. You can think of the controller as a manager between the logic of your program and the actual view that a user actually sees. Generally, a controller should have very few code. It should just execute some functions and retrieve instance variables to be used directly in a view. Moreover, it is used to do redirects with redirect_to and the likes.

A model is where your actual business logic is. The body of your main functions should always lie inside a model that is responsible for handling that data. Since a model operates on data, it’s pretty sensible that a model actually represents a database ta

View sinatra-warden.rb
# -*- encoding: utf-8 -*-
require 'sinatra'
require 'slim'
require 'warden'
require 'dm-core'
require 'dm-migrations'
DataMapper::Logger.new(STDOUT, :debug)