Skip to content

Instantly share code, notes, and snippets.

View wohckcin's full-sized avatar
🚧

Nick Chow wohckcin

🚧
View GitHub Profile
@wohckcin
wohckcin / product.rb
Created April 4, 2012 14:27
Rials, Validates form "Agile Web Development with Rails 3.2"
#---
# Excerpted from "Agile Web Development with Rails",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
#---
class Product < ActiveRecord::Base
validates :title, :description, :image_url, presence: true
@wohckcin
wohckcin / user.rb
Created April 8, 2012 08:18
Rails, User Validates
#---
# Excerpted from "Agile Web Development with Rails",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
#---
class User < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
@wohckcin
wohckcin / FMInfoPanelViewController.h
Created April 22, 2012 09:31 — forked from FlorianMielke/FMInfoPanelViewController.h
Info Panel attached to a UIScrollViewIndicator like in the Path 2 app. More information: http://cl.ly/CN2p
//
// FMInfoPanelViewController.h
// Created by Florian Mielke (@FlorianMielke) on 06.12.11.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
@interface FMInfoPanelViewController : UIViewController <UIScrollViewDelegate>
@wohckcin
wohckcin / osx_lion_rail_setup.md
Created May 6, 2012 09:46 — forked from jpantuso/osx_lion_rail_setup.md
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@wohckcin
wohckcin / schema.rb
Created May 28, 2012 04:34 — forked from loss-zz/schema.rb
schema.rb
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
@wohckcin
wohckcin / gist:2896024
Created June 8, 2012 14:55 — forked from xdite/gist:1391980
stackoverflow & reddit
module Order
module Ranking
def self.included(base)
base.extend(ClassMethods)
end
def update_r_ranking
t = self
t.r_ranking = Topic.calculate_ranking(t.pushes_count, t.created_at)
t.save(:validate => false)
@wohckcin
wohckcin / mountain-lion-brew-setup.markdown
Created July 29, 2012 15:11 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@wohckcin
wohckcin / chefdk-rvm.sh
Created June 22, 2016 13:38 — forked from asnodgrass/chefdk-rvm.sh
Making ChefDK work with RVM
# Assumption: Mac OS X
CHEFDK="/opt/chefdk/embedded"
CHEFDK_USER="$HOME/.chefdk/gem/ruby/2.1.0"
RVM_GEMS="$HOME/.rvm/gems"
RVM_RUBIES="$HOME/.rvm/rubies"
RUBY_NAME="ext-chefdk-ruby"
mkdir -p $RVM_RUBIES/$RUBY_NAME
ln -s $CHEFDK/bin $RVM_RUBIES/$RUBY_NAME
@wohckcin
wohckcin / .gitignore
Created July 10, 2017 06:30 — forked from karmi/.gitignore
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@wohckcin
wohckcin / styles.less
Created July 22, 2017 02:40 — forked from nemoDreamer/styles.less
Subtle italics in Atom syntaxes
atom-text-editor.editor {
.syntax--punctuation.syntax--whitespace.syntax--comment.syntax--leading,
.syntax--source {
font-family: FiraCode-Retina; // https://github.com/tonsky/FiraCode
text-rendering: optimizeLegibility;
letter-spacing: 0;
}
.syntax--string.quoted,
.syntax--string.regexp {