Skip to content

Instantly share code, notes, and snippets.

Avatar

Juho Vepsäläinen bebraw

View GitHub Profile
View TextField.js
/* @flow */
import React, { Component } from 'react';
import Ruler from '../Ruler/Ruler.jsx';
type Style = {
textColor?: string;
floatingLabelColor?: string;
};
@bebraw
bebraw / vec.js
Created Oct 25, 2013
Simple, generic Vector thinger for JS. Just basic ops.
View vec.js
var Vec = decorate({
add: function(a, b) {return a + b;},
sub: function(a, b) {return a - b;},
div: function(a, b) {return a / b;},
mul: function(a, b) {return a * b;}
}, function(op) {
return function() {
var pos = arguments[0].slice();
var i, len, arg;
@bebraw
bebraw / hermite.js
Last active Dec 26, 2015
Arbitrary hermite curve thingy for Canvas.
View hermite.js
$(main);
function main() {
var $c = $('#demo');
var ctx = $c[0].getContext('2d');
ctx.translate(0, $c.height());
ctx.scale(1, -1);
var points = [[0, 0], [55, 43], [94, 226], [255, 255]];
drawCurve(ctx, hermite(points));
@bebraw
bebraw / active.md
Created Dec 12, 2015
Most active GitHub users in Finland (2015)
View active.md

Most active GitHub users in Finland (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Fri, 12 Dec 2014 12:29:07 GMT till Sat, 12 Dec 2015 12:29:07 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
  .filter(user => user.followers > 12)
@bebraw
bebraw / compile_plugin.js
Created Jun 28, 2013
Generic compiler plugin for james.js.
View compile_plugin.js
var james = require('james');
module.exports = function(options) {
return james.createStream(function(file, callback) {
callback(options.compiler.compile(file, options)(options.context));
});
};
@bebraw
bebraw / notify.js
Created Jun 22, 2013
Pipe to OS X notifier. Requires https://npmjs.org/package/node-notifier and https://github.com/alloy/terminal-notifier . You can install latter through MacPorts (port install terminal-notifier). Usage: foo | ./notify.js
View notify.js
#!/usr/bin/env node
var notifier = require('node-notifier');
var stdin = process.openStdin();
stdin.setEncoding('utf8');
stdin.on('data', function(chunk) {
notifier.notify({message: chunk});
});
View gist:5719262
$ ping cdn.jsdelivr.net
PING 531151672.r.worldcdn.net (94.254.0.25): 56 data bytes
64 bytes from 94.254.0.25: icmp_seq=0 ttl=55 time=31.281 ms
64 bytes from 94.254.0.25: icmp_seq=1 ttl=55 time=29.416 ms
64 bytes from 94.254.0.25: icmp_seq=2 ttl=55 time=31.258 ms
64 bytes from 94.254.0.25: icmp_seq=3 ttl=55 time=28.973 ms
64 bytes from 94.254.0.25: icmp_seq=4 ttl=55 time=28.925 ms
64 bytes from 94.254.0.25: icmp_seq=5 ttl=55 time=31.554 ms
64 bytes from 94.254.0.25: icmp_seq=6 ttl=55 time=31.247 ms
64 bytes from 94.254.0.25: icmp_seq=7 ttl=55 time=34.498 ms
View transparency_demo.js
var context, directives;
context = {
"header": "Colors",
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
],
"empty": false
View transparency_markup.jade
.container
h1.header
ul.items
li
a.name
.empty
View data.json
{
"header": "Colors",
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
],
"empty": false
}