一对一关系:有 A 和 B,A 拥有且仅拥有一个 B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project :test => :shoulda, :renderer => :haml, :stylesheet => :sass, :script => :jquery, :orm => :activerecord | |
#default routes | |
APP_INIT = <<-APP | |
get "/" do | |
"Hello World!" | |
end | |
get :about, :map => '/about_us' do | |
render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# [sudo] gem install mechanize | |
# ruby tumblr-photo-ripper.rb | |
require 'rubygems' | |
require 'mechanize' | |
# Your Tumblr subdomain, e.g. "jamiew" for "jamiew.tumblr.com" | |
site = "doctorwho" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
import Image, ImageDraw, ImageFont | |
import struct | |
font_width = 16 | |
font = ImageFont.truetype("/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc", font_width) | |
def get_font_data(char): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clean, simple, compatible and meaningful. | |
# Tested on Linux, Unix and Windows under ANSI colors. | |
# It is recommended to use with a dark background. | |
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white. | |
# | |
# Mar 2013 Yad Smood | |
# VCS | |
YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " | |
YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}" |
#ST2/3 Search result syntax highlighting
##Introduction and disclaimer
This is gist contains an edited Find Results.hidden-tmLanguage
which adds syntax highlighting to your ST search results.
As far as I know, there is no plugin that does this and for that reason it needs to be done via config.
DISCLAIMER: Use this HACK at your risk and backup the original files you are about to mess with.
##Usage Guide for Sublime Text 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* jshint node: true */ | |
'use strict'; | |
var program = require('commander'); | |
function add(a, b){ | |
return a + b; | |
} | |
function numericSort(a,b) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AMS | |
module V09 | |
class Serializer < ActiveModel::Serializer | |
def serializable_hash(adapter_options = nil, | |
options = {}, | |
adapter_instance = self.class.serialization_adapter_instance) | |
object.nil? ? nil : super | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
OlderNewer