Skip to content

Instantly share code, notes, and snippets.

@smathy
smathy / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
class GridBounds
constructor: (bounds) ->
[ 'min', 'max' ].forEach (mm) =>
[ 'x', 'y' ].forEach (xy) =>
@[ mm + xy.toUpperCase() ] = Math[mm] bounds[0][xy], bounds[1][xy]
## this
for j in arr
alert i for i in j
## or this
for j in arr
for i in j
alert i
.cart_title = t('.title')
%table
= render(cart.line_items)
%tr.total_line
%td{:colspan => "2"} Total
%td.total_cell= number_to_currency(cart.total_price)
= button_to t('.checkout'), new_order_path, method: :get
= button_to t('.empty'), cart, method: :delete, confirm: 'Are you sure?'
@smathy
smathy / gh.sh
Created October 7, 2011 00:47 — forked from marioBonales/gh.sh
#!/bin/sh
current_git_branch() {
git_exists=`git branch 2>/dev/null | sed -ne'/^\* /s///p'`
if [[ "$git_exists" != "" ]]; then
if [[ "$git_exists" == "(no branch)" ]]; then
git_exists="\e[31m\]$git_exists\e[0m\]"
fi
echo "$git_exists "
class CatalogArea
# == Schema Information
#
# Table name: catalog_areas
#
# id :integer(4) not null, primary key
# name :string(255)
end
#!/usr/bin/env ruby
section_start = '## devstart -- section marker - do not touch'
section_end = '## devend -- section marker - do not touch'
ips = {
:juan => '3.40',
:jose => '3.138',
:alejandro => '3.139',
:roberto => '3.140',
@smathy
smathy / survey.md
Created November 6, 2009 00:35 — forked from radar/survey.md

What did you do to get good at Rails?

In order...

  1. Got good at Ruby (read the pickaxe cover-to-cover).
  2. Read a Rails tutorial (AWDwR).
  3. Found a cooperative commercial client to write an actual application for (and billed him at reduced rates because I was learning).
  4. Found every forum I could online to find people asking questions, then researched (mainly in the Rails source) and answered questions I was pretty sure of. Waited for others to answer questions I wasn't sure of and checked my answers against theirs.

Who taught you what you know?