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 / 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 / config.json
Last active November 17, 2015 14:27
Dj Mix
{
"poster": "https://hearthis.at/_/cache/images/track/800/01df998a5d6b469dfcb0d499f5e35f40_w800_v3.jpg",
"title": "#ChaosComunicationCamp2015 ChillOut - BarbNerdy CCCamp15 - Riders on the Storm",
"permalink": "https://hearthis.at/barbnerdy/chaoscamp2015chilloutbarbnerdycccamp15/",
"publicationDate": "2015-08-20",
"sources": [
{ "type": "audio/mp3", "src":"https://hearthis.at/barbnerdy/chaoscamp2015chilloutbarbnerdycccamp15/stream.mp3?s=gPa" }
],
"summary": "I had the pleasure to organize a pretty nice Line-Up for this years Chaos Communicattion Camp: <a href='https://events.ccc.de/camp/2015/wiki/Projects:Hufeisenbar'>Hufeisenbar</a> And here is a part of my set. It ended pretty spectacuar due to an upcoming thunderstorm -- Riders on the Storm -- included.",
"license": {
@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;

@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 / reinstall-all-casks.zsh
Last active July 21, 2016 08:34
force reinstallation of all currently installed casks
#!/usr/bin/env zsh
brew cask install --force $(brew cask list)
@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 / dabblet.css
Last active December 25, 2016 14:16
SVG paths: Multiple shapes with 1 path command
/**
* SVG paths: Multiple shapes with 1 path command
*/
svg {
height: 90vh;
}