Skip to content

Instantly share code, notes, and snippets.

View polygonplanet's full-sized avatar

polygonplanet polygonplanet

View GitHub Profile
@inaz2
inaz2 / japanese-generations-2016.md
Last active July 6, 2024 07:39
日本の世代と2016年時点での年齢
世代 出生年 年齢 時勢
昭和一桁世代 1927年-1934年 82歳-89歳 世界恐慌
焼け跡世代 1935年-1946年 70歳-81歳 第二次世界大戦終戦
全共闘世代 1941年-1949年 67歳-75歳 全共闘運動、安保闘争
団塊の世代 1947年-1949年 67歳-69歳 第一次ベビーブーム
しらけ世代 1950年-1964年 52歳-66歳 第一次オイルショック
新人類 1961年-1970年 46歳-55歳 共通一次試験開始、サブカルチャー隆盛
バブル世代 1965年-1969年 47歳-51歳 ツッパリ文化
団塊ジュニア 1971年-1974年 42歳-45歳 第二次ベビーブーム
@mono0926
mono0926 / commit_message_example.md
Last active November 30, 2025 13:54
[転載] gitにおけるコミットログ/メッセージ例文集100
@anhldbk
anhldbk / binder.js
Last active August 22, 2022 13:55
Bind this for all methods in ES6 classes
'use strict';
class Binder {}
Binder.getAllMethods = function(instance, cls) {
return Object.getOwnPropertyNames(Object.getPrototypeOf(instance))
.filter(name => {
let method = instance[name];
return !(!(method instanceof Function) || method === cls);
});
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
module NeuralNetwork where
import Data.Array.Repa as Repa
import Data.Array.Repa.Algorithms.Matrix
import qualified Data.Array.Repa.Operators.Mapping as Mapping
import Debug.Trace (trace)
@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
@pmuellr
pmuellr / cpu-percent.js
Created April 12, 2016 14:59
get CPU usage percent for a process in node, using proposed `process.cpuUsage()` function
'use strict'
// see: https://github.com/nodejs/node/pull/6157
var startTime = process.hrtime()
var startUsage = process.cpuUsage()
// spin the CPU for 500 milliseconds
var now = Date.now()
while (Date.now() - now < 500)
@DmitrySoshnikov
DmitrySoshnikov / expression-only.md
Last active April 16, 2016 12:00
ES: Expression only

"Everything is an expression"... since ES1?

Many languages support "expression-only" semantics, allowing to use any construct in an expression position.

NOTE: the difference between expressions and statements is that the former produce a value, while the later don't.

For example, Ruby's if-expression:

x = 10
@rauchg
rauchg / README.md
Last active April 13, 2025 04:29
require-from-twitter
@uri-chandler
uri-chandler / apply-apply.js
Last active March 15, 2016 07:57
[Case study: Applying advanced javascript] Code 2
// In older IE, this function doesn't inherit from Function.prototype
// so there's no .apply() we can use.
// This will throw an error
document.getElementById.apply(document, ['myDiv']) // Error!
// The solution:
(Function.prototype.apply).apply(document.getElementById, [document, ['myDiv']]); // Smooth!