Skip to content

Instantly share code, notes, and snippets.

@JimmyLv
JimmyLv / auth.js
Created July 13, 2017 05:33
HOC AuthedComonent
import React, { Component } from 'react';
import userStorage from '../shared/storage/user';
import history from '../history';
const connectAuthCheck = doCheckFn => (Comp) => {
class AuthedComonent extends Component {
state = {
authed: false,
};
@Yangff
Yangff / strong.rb
Last active January 25, 2016 10:15
strong type system for ruby
class Symbol
def [](*args)
a = [self, args, '[]']
a.instance_eval('@_type_flag = \'[]\'')
a
end
def <<(*ary)
a = [self, ary.flatten, '<']
a.instance_eval('@_type_flag = \'<\'')
a
/*
* 引入voidable修饰符,用于修饰泛型参数。
* 被修饰的泛型参数T,可以在代码里具体化为void类型。
*/
class Task<voidable T> { } // 带有voidable修饰
class List<T> { } // 不带voidable修饰
/*
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@voluntas
voluntas / luli.rst
Last active October 28, 2018 14:01
Lua 言語用ソースコード静的解析ツール

Lua 言語用ソースコード静的解析ツール

日時:2014-05-24
作:時雨堂
バージョン:1.1.10
url:http://shiguredo.jp/

Lua ソースコード静的解析ツールは 時雨堂 が開発し販売をしています

@ms-tg
ms-tg / jdk8_optional_monad_laws.java
Created November 11, 2013 21:14
Does JDK8's Optional class satisfy the Monad laws? Yes, it does.
/**
* ```
* Does JDK8's Optional class satisfy the Monad laws?
* =================================================
* 1. Left identity: true
* 2. Right identity: true
* 3. Associativity: true
*
* Yes, it does.
* ```
@aras-p
aras-p / preprocessor_fun.h
Last active September 8, 2024 07:43
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
var empty_list = function(selector) {
return selector(undefined, undefined, true);
};
var prepend = function(el, list) {
return function(selector) {
return selector(el, list, false);
};
};
var head = function(list) {
var empty_list = function(selector) {
return selector(undefined, undefined, true);
};
var prepend = function(el, list) {
return function(selector) {
return selector(el, list, false);
};
};
var head = function(list) {
@amoilanen
amoilanen / webcrawler.js
Last active March 24, 2022 03:14
Simple PhantomJS-based web crawler library
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};