Skip to content

Instantly share code, notes, and snippets.

View shunwen's full-sized avatar
🐢

shunwen shunwen

🐢
View GitHub Profile
@whitingx
whitingx / meta-tags.md
Created October 5, 2012 16:41 — forked from kevinSuttle/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@jbarona
jbarona / gist:3444459
Created August 24, 2012 01:23
Timestamp fun
# no config
Time.now is localtime
1.second.from_now is UTC
Timestamp stored in UTC
AR not translated
Time.now: Fri Aug 24 10:22:25 +0930 2012
1.second.from_now 2012-08-24 00:52:26 UTC
@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@zenkay
zenkay / gist:3237860
Created August 2, 2012 15:19
Installation tips for RVM/Ruby on OSX 10.8 Mountain Lion

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

@ledsun
ledsun / toWareki.js
Created July 23, 2012 04:51
JavaScript 西暦→和暦の変換処理
function toWareki(year,month,day)
{
var wareki = "";
year = Number (year);
if (year == 1868)
{
/* 9月8日から明治元年 */
/* 誕生日がここの人はいないだろうから細かくは気にしない */
wareki = '明治元年';
}
@davidjrice
davidjrice / redcarpet.rb
Created June 29, 2012 00:34
Rails 3.2 Markdown Template Handler
# config/initializers/redcarpet.rb
module ActionView
module Template::Handlers
class Markdown
class_attribute :default_format
self.default_format = Mime::HTML
def call(template)
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
markdown.render(template.source).html_safe.inspect
@pzol
pzol / README.md
Created June 5, 2012 07:23
RVM + Puma + Ubuntu

Running Puma on Nginx

I use the latest Puma v1.4.0 from rubygems.

Make sure you have nginx installed with these options:

>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15

built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

@letoh
letoh / gist:2790559
Last active March 13, 2024 07:23
[筆記] 為什麼在 x86,MBR 會被載入到 0x7C00?(完全版)

原文 Assembler / なぜx86ではMBRが"0x7C00"にロードされるのか?(完全版)

感謝 descent 大大分享本文,隨便看隨便譯。本文不是逐句譯,同時也不是這方面的專家 (不管是語言或技術),用語不一或缺漏錯誤在所難免,歡迎自行 fork 修正指教

誰適合看本文?

對 x86 架構與組合語言有基礎認識,以及從 MBR 到載入 OS 這一段過程有興趣的人 (還有談到中斷向量或 INT xxx 時不會一臉茫然的人)

@andrerpbts
andrerpbts / contato_mailer.rb
Created May 25, 2012 11:15
IMAP Mail Receive Ruby
#encoding: utf-8
class ContatoMailer < ActionMailer::Base
def receive(message)
p message
end
end
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)