Skip to content

Instantly share code, notes, and snippets.

edvakf

Block or report user

Report or block edvakf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mymaybe.hs
data MyMaybe a = MyNothing | MyJust a deriving (Show)
instance Functor MyMaybe where
fmap f MyNothing = MyNothing
fmap f (MyJust a) = MyJust (f a)
instance Applicative MyMaybe where
pure x = MyJust x
MyNothing <*> _ = MyNothing
_ <*> MyNothing = MyNothing
@edvakf
edvakf / Rpc.scala
Last active Aug 29, 2015
ThriftRpc
View Rpc.scala
import com.ning.http.client.providers.netty.NettyResponse
import org.apache.thrift.protocol.TBinaryProtocol
import org.apache.thrift.transport.{TMemoryInputTransport, TMemoryBuffer, THttpClient}
import org.apache.thrift.{TException, TServiceClient, TServiceClientFactory}
import play.api.Play.current
import play.api.libs.ws.WS
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.util.control.NonFatal
View simd-test.js
var a = SIMD.Float32x4(1.0,2.0,3.0,4.0);
var b = SIMD.Float32x4(5.0,6.0,7.0,8.0);
var c = SIMD.Float32x4.add(a,b);
console.log(SIMD.Float32x4.extractLane(c, 0));
console.log(SIMD.Float32x4.extractLane(c, 1));
console.log(SIMD.Float32x4.extractLane(c, 2));
console.log(SIMD.Float32x4.extractLane(c, 3));
var a = SIMD.Int32x4(1,2,3,4);
var b = SIMD.Int32x4(5,6,7,8);
View spacnav-highlight.js
// ==UserScript==
// @name spacnav-highlight.js
// @description Highlight the targets of spacial navigation
// @namespace http://d.hatena.ne.jp/edvakf/
// @include http://*
// ==/UserScript==
(function(){
var keyHash = {
16 : 'shift',
View purify.js
javascript: (function(doc) {
function addListeners(){
var add = window.addEventListener;
add('mouseover',overHandler,false);
add('mouseout',outHandler,false);
add('click',clickHandler,false);
add('keypress',keyHandler,false);
}
function removeListeners(){
var rm = window.removeEventListener;
View fastladder_fixed_item_height.user.js
// ==UserScript==
// @name fastladder_fixed_item_height.user.js
// @namespace http://d.hatena.ne.jp/edvakf/
// @description Limit the height of items on LDR/Fastladder
// @include http://reader.livedoor.com/reader/
// @include http://reader.livedoor.com/public/*
// @include http://fastladder.com/reader/
// ==/UserScript==
// The "IE OK?" lines **might** work for IE as well
View fastladder_show_fc2_images.user.js
// ==UserScript==
// @name fastladder_show_fc2_images.user.js
// @namespace http://d.hatena.ne.jp/edvakf/
// @description Make fc2 images viewable on LDR/Fastladder
// @include http://reader.livedoor.com/reader/
// @include http://reader.livedoor.com/public/*
// @include http://fastladder.com/reader/
// ==/UserScript==
(function(w,d){
View autoGrow.js
//for Firefox
//javascript:
(function(){
var ta=document.createElement('textarea');
ta.rows=1;
ta.id='fuga';
ta.style.height='auto';
ta.style.minHeight='none';
document.body.appendChild(ta);
var st=getComputedStyle(ta,'');
View ore_ore_text_url_linker.js
javascript:(function TextURLLinker() {
var TAG = 'a';
var STYLE = 'color:#13819f;display:inline !important;';
if (document.contentType && !/html/i.test(document.contentType))
return;
var fn = function(doc) {
$XA('descendant::text()[contains(self::text(),"ttp") and not(ancestor::a) and not(ancestor::textarea) and not(ancestor::script) and not(ancestor::style)]', doc)(function(txt) {
var df, text = txt.nodeValue.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'),
parent = txt.parentNode, range = document.createRange(),
newText = text.replace(/h?(ttps?:\/\/[^\s\])'")」】]+)/g, function($0, $1) {
View cleanAutoPagerize.js
// ==UserScript==
// @name cleanAutoPager
// @namespace http://d.hatena.ne.jp/
// @description
// @include http://*
// @include https://*
// @exclude https://mail.google.com/*
// ==/UserScript==
(function(){
You can’t perform that action at this time.