Skip to content

Instantly share code, notes, and snippets.

View jzntam's full-sized avatar

Jason Tam jzntam

View GitHub Profile
Ruby Quickstart for Refugees:
--
# is a comment.
You don't need semicolons.
Ruby aims to be elegant and readable, so punctuation and boilerplate are
minimal.
--
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@jaysonrowe
jaysonrowe / FizzBuzz.js
Created January 11, 2012 01:39
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);
@jeremyw
jeremyw / accounts_controller.rb
Created September 29, 2012 21:25
Testing Rails 4 strong parameters
class AccountsController < ApplicationController
def update
@account = Account.find(params[:id])
respond_to do |format|
if @account.update_attributes(account_params)
format.html { redirect_to @account, notice: 'Account was successfully updated.' }
else
format.html { render action: "edit" }
end
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@geksilla
geksilla / bootsrap_class_list
Last active April 29, 2023 03:59
Bootstrap css class list
.navbar
.caret
.label
.table
.img-responsive
.img-rounded
.img-thumbnail
.img-circle
.sr-only
.lead
@hofmannsven
hofmannsven / README.md
Last active June 4, 2024 04:25
Git CLI Cheatsheet
@JoshReedSchramm
JoshReedSchramm / collection_check_boxes.html.erb
Created October 27, 2013 00:05
An example of customizing collection_check_boxes in Rails 4. -- I'm working on converting a rails 3.2 app to Rails 4 and noticed that a couple of helpers from simple_form are now in the Rails core. I wanted to move away from dependencies as much as possible including getting rid of simple_form if possible so I went about converting the old view …
<%= f.collection_check_boxes :venue_ids, Venue.all, :id, :name, checked: Venue.all.map(&:id) do |b| %>
<span>
<%= b.check_box %>
<%= b.label %>
</span>
<% end %>