Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View line-o's full-sized avatar
🌱
weeding the garden

Juri Leino line-o

🌱
weeding the garden
View GitHub Profile
@line-o
line-o / node-ASCIIp.js
Created May 25, 2011 07:48
tiny (nano) module for ASCII pattern output
/**
* node-ASCIIp
* @author: contact@line-o.de
*
* Example:
* var write = require('./node-ASCIIp');
* console.log(write(' _.*._ ',12,5));
*/
module.exports = ASCIIp;
@line-o
line-o / fi.json
Created August 30, 2011 09:29 — forked from cramforce/de.json
lang.json
{
"locale": "fi",
"text": {
"#authors": [
{
"name": "Juri Leino",
"screen-name": "line-o"
}
],
"tweet": {
@line-o
line-o / bt-search.coffee
Created January 27, 2012 09:17 — forked from usefulthink/bt-search.coffee
backtracking combinator
# searches a combination of the given elements that matches toMatch
# @param c array - initially empty, carries the current combination throught
# the recursion
# @param els array - the predefined set of elements
# @param toMatch string - the rest-string to be matched with the elements
#
# @return an array of combinations that recursively match
searchCombination = (c, els, rest) ->
return c if rest.length==0
@line-o
line-o / PS.js
Created January 27, 2012 09:18
node js module to find a representation for a string with chemical elements
var TU = require('./TypeUtils'),
elements = "AcAgAlAmArAsAtAuBBaBeBhBiBkBrCCaCdCeCfClCmCnCoCrCsCuDbDsDyErEsEuFFeFmFrGaGdGeHHeHfHgHoHsIInIrKKrLLaLiLrLuMMdMgMnMoMtNNaNbNdNeNiNoNpOOsPPaPbPdPmPoPrPtPuQRaRbReRfRgRhRnRuSSbScSeSgSiSmSnSrTaTbTcTeThTiTlTmUUuhUuoUupUuqUusUutVWXeYYbZnZr"
RNG_MIN = 65, //'A'
RNG_MAX = 90, //'Z'
abbrevs = [],
hashes = new Object(null)
name = process.argv[2]
function matcher(a) {
var s=a.toLowerCase()
@line-o
line-o / testIsArrayOf.js
Created February 1, 2012 17:46
isArrayOf(array2test, type2match)
var typeUtils =
literals = ['boolean', 'string', 'number', 'object'],
types2test = literals.concat([new RegExp(/asd/), new Number(1), new String('#')]),
testArrays = [
[true, false, true],
[1, 2, 3],
['a', 'b', 'c'],
[/sdf/, /asdf/, /asf/],
[{}, {}, {}],
[new String('a'), new String('b'), new String('c')],
@line-o
line-o / ar-drone-lowbat.js
Created October 5, 2012 15:37
Node AR Drone Warn on low Battery Status
/**
* Warn on console and turn all LEDs red if battery is not charged enough to take off
* usage:
* ```client.on('navdata', warnOnLowBat);```
*/
var warnOnLowBat = function (nav){
if (nav.droneState.lowBattery === 1) {
this.animateLeds('red', 1, 1);
console.warn('New battery please!');
}
@line-o
line-o / SandBox.js
Created October 6, 2012 19:09
Evaluate JavaScript code in a configurable Sandbox (no Iframes here)
var SandBox = (function (realCtx) {
var get = realCtx.document.getElementById.bind(realCtx.document),
_evil = eval;
return {
init: function (form, script, ctx) {
this._form = get(form);
this._script = get(script);
this.fakeCtx = ctx;
this._form.onsubmit = SandBox.evaluate;
@line-o
line-o / SandBox.js
Created October 8, 2012 14:30 — forked from aemkei/SandBox.js
Is it possible to sandbox JS code
function sandbox(script, context){
context.window = {};
for (var key in context){
context.window[key] = context[key];
}
context.global = context.window;
eval("with (context){ " + script + " }");
}
@line-o
line-o / README.md
Last active December 17, 2015 06:49
working google webfont import mixins for current stable (v1.3.3) and upcoming beta (v1.4) of less with default parameters derived from this discussion <http://stackoverflow.com/posts/16524650/>

tbd;

Keybase proof

I hereby claim:

  • I am line-o on github.
  • I am line0 (https://keybase.io/line0) on keybase.
  • I have a public key whose fingerprint is 9620 445B D7C6 7742 66CD 11C5 FDF1 76EB 91B4 4D74

To claim this, I am signing this object: