Skip to content

Instantly share code, notes, and snippets.

@shimomura1004
shimomura1004 / asakusasatellite_migration_for_v0.7.0
Created May 26, 2012 05:19
migration script for asakusasatellite v0.7.0 or older
db.messages.update({}, {$unset : { updated_at : 1 }}, false, true)
db.messages.update({}, {$unset : { room : 1 }}, false, true)
db.messages.update({}, {$rename : { "user._id" : "user_id" }}, false, true)
db.messages.update({}, {$unset : { user : 1 }}, false, true)
db.messages.dropIndex({created_at:-1})
db.repairDatabase()
@shimomura1004
shimomura1004 / unreadcounter.js
Last active October 13, 2015 11:28
unread message counter for AsakusaSatellite (tested with chrome)
/*!
AsakusaSatellite Unread Counter
*/
function load_Tinycon(){
/*!
Tinycon - A small library for manipulating the Favicon
Tom Moor, http://tommoor.com
Copyright (c) 2012 Tom Moor
MIT Licensed
@shimomura1004
shimomura1004 / gist:4393436
Last active December 10, 2015 06:18
asakusa-satellite traditional style
@charset "UTF-8";
body {
background-color: #fafafa;
color: #333333; }
.header {
height: 70px;
margin: 15px;
margin-bottom: 40px;
border-bottom: 1px solid #cccccc; }
@shimomura1004
shimomura1004 / gist:4393448
Last active December 10, 2015 06:18
asakusa-satellite simple style
body {
background-image: url(bedge_grunge.png);
color: #333333; }
.header {
height: 70px;
margin: 15px;
margin-bottom: 40px;
border-bottom: 1px solid #cccccc; }
.header > a {
(function(){
if (location.pathname.indexOf("/chat/room") == 0) {
var message = $("#message").css({
"-webkit-transition" : "height 0.3s ease-in-out",
"-webkit-transition" : "width 0.3s ease-in-out",
"transition" : "height 0.3s ease-in-out",
"transition" : "width 0.3s ease-in-out",
});
var defaultStyle = {
module test where
data _≡_ {A} : A → A → Set where
refl : {a : A} → a ≡ a
cong : ∀ {A B} {a₁ a₂ : A} → (f : A → B) → (a₁ ≡ a₂) → f a₁ ≡ f a₂
cong _ refl = refl
sym : ∀ {A} {a₁ a₂ : A} → a₁ ≡ a₂ → a₂ ≡ a₁
sym refl = refl
@shimomura1004
shimomura1004 / gist:8277713
Last active January 2, 2016 08:39
github のプライベートリポジトリ毎に鍵を切り替える設定 http://www.snipe.net/2013/04/multiple-github-deploy-keys-single-server/
Host repo-a-shortname github.com
Hostname github.com
IdentityFile /home/deployme/.ssh/repo-a-rsa
#User username-on-remote-machine
Host repo-b-shortname github.com
Hostname github.com
IdentityFile /home/deployme/.ssh/repo-b-rsa
#User username-on-remote-machine
@shimomura1004
shimomura1004 / factor
Created August 4, 2014 13:59
factor function in llvm assembler
@str = internal constant [4 x i8] c"%d\0a\00"
declare i32 @printf(i8*, ...)
define i32 @factor(i32 %n) {
head:
%cast_message = getelementptr [4 x i8]* @str, i32 0, i32 0
%i = alloca i32
store i32 2, i32* %i
br label %loop
@shimomura1004
shimomura1004 / gist:53b4a414fa4e328752e9
Created August 5, 2014 11:28
node-bitmap と node-pngjs で適当に変換するやつ(未完成)
var fs = require('fs');
var Bitmap = require('node-bitmap');
var PNG = require('pngjs').PNG;
var filepath = "/Users/shimo/tmp/1.bmp";
var stat = fs.statSync(filepath);
var buf = new Buffer(stat.size);
var fd = fs.openSync("/Users/shimo/tmp/1.bmp", "r");
fs.readSync(fd, buf, 0, stat.size);
@shimomura1004
shimomura1004 / gist:1228bc6cd4e031b322bf
Created September 6, 2014 02:43
defun と defvar の違い
;; 関数の名前空間に定義
(defun f (x y) (+ x y))
(f 1 2)
(funcall #'f 1 2)
;; 変数の名前空間に定義
(defvar g (lambda (x y) (+ x y)))
(funcall g 1 2)