Skip to content

Instantly share code, notes, and snippets.

View bearice's full-sized avatar
🐻

Bearice Ren bearice

🐻
View GitHub Profile
if (obj['replylinks'] !== '') {
_ref = obj['replylinks'].split('&');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
x = _ref[_i];
ret.add((x.split('='))[0]);
}
}
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !=m.moegirl.org
RewriteCond %{HTTP_USER_AGENT} .*iPhone.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*Android.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*SymbianOS.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*Windows\ Phone.*
RewriteRule ^(.*)$ http://m.moegirl.org/$1 [L,R=301]
bearice@Bearice-Mac-Air ~
%dig fanfou.icybear.net !693 [20:07:21]
; <<>> DiG 9.7.3-P3 <<>> fanfou.icybear.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2591
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 8
;; QUESTION SECTION:
@bearice
bearice / jquery.dnd.js
Created October 19, 2011 03:04
jQuery plugin for <del>Dungeon and Dragons</del> Drag and Drop Event
/**
* jQuery plugin for <del>Dungeon and Dragons</del> Drag and Drop Event
*/
(function($){
$.fn.dragAndDropFiles = function(options){
if(typeof(window.FileReader)=== 'undefined')return;
var defaults = {
MIME : ["image/png","image/jpeg","image/bmp"],
//accept = function(e){},
//cancel = function(e){},
@bearice
bearice / websocket.js
Created September 27, 2011 07:01
My own (and dirty) implementation of WebSocket-Protocol-Version-8 on nodejs
var crypto = require('crypto');
var WSProtocolHandler = {
"8":{
handshake:function(req,socket,head,callback){
var key = req.headers["sec-websocket-key"];
if(!key)return false;
key += "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
var sha1 = crypto.createHash('sha1');
sha1.update(key);
@bearice
bearice / time_utils.erl
Created August 24, 2011 06:54
strftime for erlang
-module(time_utils).
-author("Bearice Ren <[email protected]>").
-export([strftime/2]).
strftime(Fmt,{_,_,_}=Time)->
strftime(Fmt,calendar:now_to_datetime(Time));
strftime(Fmt,{_,_}=Time)->
lists:reverse(strftime(str,Fmt,Time,[])).