Skip to content

Instantly share code, notes, and snippets.

@onteria
onteria / kaomoji.txt
Created October 19, 2012 05:08
顔文字.txt
a(;`・ω・)o━ヽ_。_・_゚_・_フ))
?(っ´。ω゜`c)
☝(〃`l _ l´)☝
☝( ◠‿◠ )☝
༼(*꒪ั❥꒪ั*༽༽
(✿꒪ั◡꒪ั✿)
(੭ु ˃̶͈̀ x ˂̶͈́)੭ु⁾⁾
:(ヽ'ω`):
+。:.゚٩(๑>◡<๑)۶:.。+゚
(★l ω l)
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@ppworks
ppworks / gist:3107537
Created July 13, 2012 21:17
Backbone.js で History.pushState未実装ブラウザでhash fragmentを使わずにそのままのurlを使う
window.App =
Models: {}
Collections: {}
Views: {}
Routers: {}
init: (options)->
options = {} unless options
options.pushState = true
options.hashChange = false # don't want to rewrite /pathname to #pathname
@driehle
driehle / backbone-validation-bootstrap.js.coffee
Last active February 11, 2021 15:09
Render error messages of Backbone.Validation for Twitter Bootstrap
# --------------------------------------------
# This code is for Twitter Bootstrap 2!
# --------------------------------------------
#
# The MIT License (MIT)
# Copyright (c) 2012-2015 Dennis Riehle
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@rummelonp
rummelonp / faraday.md
Last active May 20, 2022 12:23
Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた

[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた

@mikegrassotti
mikegrassotti / gist:2247065
Created March 30, 2012 05:55
Using sed to upgrade to Factory Girl 3
# FactoryGirl3ForYouAndMe
# The new syntax: http://robots.thoughtbot.com/post/19412394597/factory-girl-hits-3-0
#
# Where to learn sed?
# http://www.grymoire.com/Unix/Sed.html#uh-6
# http://www.markhneedham.com/blog/2011/01/11/sed-across-multiple-files/
#
# What needs to change?
find . -type f -name "*.rb" -print0 | xargs -0 grep "Factory.create"
find . -type f -name "*.rb" -print0 | xargs -0 grep "Factory.build"
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@chetan
chetan / yardoc_cheatsheet.md
Last active April 13, 2025 14:08
YARD cheatsheet
@snoozer05
snoozer05 / gist:1477002
Created December 14, 2011 15:23
sumim さんのボウリング集計のコード(http://d.hatena.ne.jp/sumim/20111214/p1)を Ruby で
def score1(pins)
cursor = 0
frame_points = []
9.times do
frame_points << pins[cursor, 3]
cursor += 2
if frame_points.last.first == 10
cursor -= 1
else
if frame_points.last.take(2).inject(:+) != 10
@fatihacet
fatihacet / pubsub-simple.js
Created October 15, 2011 22:02
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,