Skip to content

Instantly share code, notes, and snippets.

Avatar

Rei Kawai animist

  • Uniba Inc.
  • Shibuya
View GitHub Profile
@animist
animist / gist:7a0a079b40dfa922a31bebba10774213
Created Feb 6, 2020
効率悪くサイコロを振り続ける
View gist:7a0a079b40dfa922a31bebba10774213
from random import shuffle
from math import floor
def setup():
global array, loop_counter
array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
loop_counter = 0
size(1280, 720, P3D)
background(0)
@animist
animist / patch.fix.hatena.addbookmark.tbrl.js
Last active Nov 28, 2018
patch.fix.hatena.addbookmark.tbrl.js
View patch.fix.hatena.addbookmark.tbrl.js
// ==Taberareloo==
// {
// "name" : "Fix Hatena.addBookmark 2018.11"
// , "description" : "Fix Hatena.addBookmark 2018.11"
// , "include" : ["background"]
// , "version" : "0.0.1"
// , "downloadURL" : "https://gist.githubusercontent.com/animist/d9e11ad8fc2922cde66fd5118141593e/raw/4efa6ad9c6f06e483fc08c9fe97c0674cd0066a1/patch.fix.hatena.addbookmark.tbrl.js"
// }
// ==/Taberareloo==
@animist
animist / unreadable code
Last active Dec 19, 2015
アンリーダブルコードできたよー
View unreadable code
function fn_old(location_info) {
return "" + !location_info["LocalityName"] ? !location_info["SubAdministrativeAreaName"] ? !location_info["AdministrativeAreaName"] ? "Middle-of-Nowhere" : location_info["AdministrativeAreaName"] : location_info["SubAdministrativeAreaName"] : location_info["LocalityName"] + ", " + !location_info["CountryName"] ? ", Plnanet Earth" : location_info["CountryName"];
}
function fn_new(location_info) {
return (location_info["LocalityName"] || location_info["SubAdministrativeAreaName"] || location_info["AdministrativeAreaName"] || "Middle-of-Nowhere") + ", " + ((location_info["CountryName"] == "USA" ? (location_info["AdministrativeAreaName"] || "USA") : location_info["CountryName"]) || "Planet Earth");
}
@animist
animist / Twitter Stream Sampling to Mroonga
Created Jun 4, 2013
Twitter のストリームを取得して Mroonga な DB に突っ込みまくるサンプル
View Twitter Stream Sampling to Mroonga
#!/usr/bin/env ruby
# coding: utf-8
require 'net/https'
require 'uri'
require 'rubygems'
require 'json'
require 'pp'
require 'data_mapper'
@animist
animist / Twitter Stream Sampling
Created Jun 3, 2013
Twitter のストリームを取得して垂れ流すサンプル
View Twitter Stream Sampling
#!/usr/bin/env ruby
# coding: utf-8
#
# http://d.hatena.ne.jp/shibason/20090816/1250405491
# にあったものを https な 1.1 API に対応させた
require 'net/https'
require 'uri'
require 'rubygems'
require 'json'
View gist:2233757
#!/usr/bin/ruby
puts "id,date,name,url,file,status,position,sort_id,pv,top"
count = 1
whole = 1662
while line = gets
if line.match(/href/)
name = line.sub(/.*>(.*)<\/a.*/, "\\1").chomp
View gist:2099934
/*
It's CSS configuration for CodeRay
from this sample
https://github.com/rubychan/coderay/blob/master/lib/coderay/styles/alpha.rb
*/
.CodeRay {
background-color: hsl(0,0%,95%);
border: 1px solid silver;
color: black;
View markdown.md

Hello world

  1. one
  2. two

The quick brown fox jumps over the lazy dog.


<script>alert(document.cookie);</script>

@animist
animist / collect_by_date.rb
Created Oct 27, 2010
File Collection Program by Date
View collect_by_date.rb
#!/usr/bin/env ruby
require 'optparse'
# Default parameters
from = Dir.pwd
dry = false
summary = <<EOT
File collection Program by Date
@animist
animist / skelton.rb
Created Oct 27, 2010
Ruby cli skelton
View skelton.rb
#!/usr/bin/env ruby
require 'optparse'
# --- Default parameters ---
a = "example"
summary = <<EOT
Program Description