Skip to content

Instantly share code, notes, and snippets.

View kyontan's full-sized avatar
♨️

kyontan kyontan

♨️
View GitHub Profile
# sinatra でのリダイレクト設定
# hoge/ のような '/' 終わりを '/' 無しへリダイレクト
# ただし、 http://example.com の場合は末尾 '/' が付く
get %r{^(.+)/$} do |c|
redirect c, 303
end
http://fladdict.net/blog/2011/02/auto-kerning.html
グローバル汚染を無くしたのと、jQueryらしくかけるようにしました。
// 引数なしの場合デフォルトのカーニングが摘要される。
$(selector).FLAutoKerning();
// 引数を入れた場合、そのカーニングが摘要される。
$(selector).FLAutoKerning(myKerningInfo);
ライセンスは元のFLAutoKerning.jsを継承します。
@hryk
hryk / glitch.rb
Created May 10, 2011 11:13
glitch your display.
#!/usr/bin/env macruby
#
# MacRubyで画面グリッチをフルスクリーン表示する
#
# http://twitter.com/negipo/status/67572370247913473
#
# ## Usage
#
# ./glitch.rb
#
@tpitale
tpitale / lib-sunspot-data_mapper.rb
Created October 16, 2011 16:18 — forked from dkubb/dm_sunspot.rb
DataMapper and Sunspot Integration Extension
module Sunspot
module DataMapper
def self.included(base)
base.class_eval do
alias new_record? new?
end
base.extend Sunspot::Rails::Searchable::ActsAsMethods
Sunspot::Adapters::DataAccessor.register(DataAccessor, base)
@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

@edwardhotchkiss
edwardhotchkiss / syntax.css
Created March 9, 2012 04:34 — forked from scotu/solarized.css
Solarized Light Pygments CSS / Jekyll
.highlight {
background-color: #efefef;
padding: 7px 7px 7px 10px;
border: 1px solid #ddd;
-moz-box-shadow: 3px 3px rgba(0,0,0,0.1);
-webkit-box-shadow: 3px 3px rgba(0,0,0,0.1);
box-shadow: 3px 3px rgba(0,0,0,0.1);
margin: 20px 0 20px 0;
overflow: hidden;
@btoone
btoone / curl.md
Last active June 29, 2024 16:01
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@repeatedly
repeatedly / d_master.md
Last active July 16, 2024 17:07
D言語基礎文法最速マスター

他の言語をある程度知っている人はこれを読めばD言語の基礎をマスターでき,D言語の氷山の一角くらいは知ることができると思います.対象バージョンはdmd 2.059です.

1. 基礎

ソースファイル

ASCIIかUTFしか受け付けません.それ以外の文字コードで書くとコンパイルエラーになります.

main

D言語のmainはCとは違い以下のようなシグネチャです.

@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
anonymous
anonymous / gist:2979612
Created June 23, 2012 19:28
Twitter OAuth
def consumer
OAuth::Consumer.new(TWITTER_CONSUMER_KEY,TWITTER_CONSUMER_SECRET,{:site=>"http://twitter.com" })
end
def loginTwitter
@req_token = consumer.get_request_token(:oauth_callback=>"http://127.0.0.1:3000/login/twitter/success")
session[:request_token] = @req_token.token
session[:request_token_secret] = @req_token.secret
redirect_to @req_token.authorize_url
end