Skip to content

Instantly share code, notes, and snippets.

View ywindish's full-sized avatar
🐈

Yamako ywindish

🐈
View GitHub Profile
@tricknotes
tricknotes / compiled-ternary-operator.js
Created May 10, 2011 08:05
CoffeeScriptで3項演算子風に書くと、コンパイルされてできあがるJavaScript
// a ? b : c
if (typeof a !== "undefined" && a !== null) {
a;
} else {
({b: c});
}
// if a then b else c
if (a) {
b;
@naoaki011
naoaki011 / config.php
Created March 13, 2012 17:12
DynamicMTML版Abs2Rel
<?php
class Abs2Rel extends MTPlugin {
var $app;
var $registry = array(
'name' => 'Abs2Rel',
'id' => 'Abs2Rel',
'key' => 'abs2rel',
'author_name' => 'Alfasado Inc.',
'author_link' => 'http://alfasado.net/',
'version' => '0.1',
@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] というものがよく使われてた

var Person = function(_name){
this.name = _name;
this.friends = [];
};
var obj = new Person("ore");
obj.friends.push(new Person("satou"));
obj.friends[0].friends.push(new Person("yamada"));
@Gab-km
Gab-km / github-flow.ja.md
Last active April 25, 2024 04:01 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@sasaki-shigeo
sasaki-shigeo / gist:3727810
Created September 15, 2012 13:18
Conversion from/to Numeric Type in Scala (Scala における数値型の変換)
import math._
1L // Long型の 1
1:Long // Long型の 1
127:Byte // Byte型の 127
32767:Short // Short型の 32767
(1+2).toLong // Long型への変換
(2+3) toLong // Long型への変換
@sacrifs
sacrifs / img_size_checker.js
Created November 30, 2012 12:15
HTMLで画像のサイズが実際のサイズと異なる場合に赤枠を付け、console.logに書き出しするブックマークレット用JS
javascript: (function(){
var d = window.document;
var s = d.createElement('script');
s.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js';
d.body.appendChild(s);
setTimeout(function(){
$("img").each(function(){
var src = $(this).attr("src");
var img = new Image();
img.src = src;
use strict;
use warnings;
use Test::More;
use Text::Xslate;
subtest 'scope ok' => sub {
my $tx = Text::Xslate->new({
syntax => 'TTerse'
});
@mgng
mgng / 1.php
Created December 21, 2012 14:42
Redis で prefix つけると、キー一覧引っ張ってきてループ処理するときに面倒
<?php
$prefix = 'TEST:';
$redis = new Redis();
$redis->connect( '127.0.0.1', 6379 );
$redis->setOption( Redis::OPT_PREFIX, $prefix );
// set
$redis->set( 'key1', 'val1' );
$redis->set( 'key2', 'val2' );
$redis->set( 'key3', 'val3' );
@maeharin
maeharin / gist:4461321
Last active May 15, 2023 06:29
WEBrickを起動させるワンライナー
# 起動
$ ruby -r webrick -e 'WEBrick::HTTPServer.new(:DocumentRoot => "./", :Port => 8080).start'
# 停止
$ ps aux | grep ruby
$ kill -9 <pid>