Skip to content

Instantly share code, notes, and snippets.

View ashnur's full-sized avatar
🐢
fragments of scrolls surround me

Aron Gabor ashnur

🐢
fragments of scrolls surround me
View GitHub Profile
@ashnur
ashnur / coffee_madness.js
Created August 18, 2012 19:48
this is why I stopped using coffeescript
function v(i){
var _ref, _ref1;
return (_ref = (_ref1 = w(i)) != null ? _ref1.lvl : void 0) != null ? _ref : Number.MIN_VALUE
}
@ashnur
ashnur / arrdiffobj.js
Created September 4, 2012 15:31
diff between array of text values and object keys
var inp = [ 'a', 'b', 'c', 'f', 'g' ]
, out = [ 'd', 'e', 'c', 'b' ]
, res = []
;
function diff(inp, out){
var del = [], ign = [] , add = []
, i, t1 = out.length, t2
;
@ashnur
ashnur / docpad.sh
Created September 19, 2012 06:13
simple debian init script
#!/bin/bash
DIR=/home/ashnur/www/docpad
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/ashnur/.nvm/v0.8.4/bin
NODE_PATH=/home/ashnur/.nvm/v0.8.4/lib/node_modules
NODE=/home/ashnur/.nvm/v0.8.4/bin/node
test -x $NODE || exit 0
function start_app {
`docpad run --env production 1>>"$DIR/../logs/docpad.log" 2>&1 &`·
@ashnur
ashnur / docpad.coffee
Created September 19, 2012 14:13
how to enable the livereload plugin in docpad's twitter bootstrap skeleton
#the plugins section should look something like this:
plugins:
livereload:
enabled: true
environments:
production: #this obviously has to be the env in which you want to enable the plugin
enabled: true
@ashnur
ashnur / presentation.js
Created October 3, 2012 20:41
useless piece of code
void function(){
"use strict"
var bean = require('bean')
, KeySpline = require('./keyspline.js')
, splineFrom = new KeySpline(0.93,0.01,0.12,0.99)
, splineTo = new KeySpline(0.93,0.01,0.12,0.99)
, $ = function(id){ return document.getElementById.call(document, id) }
, $$ = function(selector, parent){ parent = parent || document; return parent.querySelectorAll.call(parent, selector) }
, lock = false
, slideshow , slides , steps, target
@ashnur
ashnur / index.js
Created October 19, 2012 11:42
example bouncy script
var bouncy = require('bouncy');
bouncy(function(req, bounce){
if ( req.headers.host === 'domain.example.com' ) {
bounce(9999)
}
}).listen(8888)
@ashnur
ashnur / static.js
Created October 27, 2012 20:41
node static server with passport and dnode and show and whatever
void function(root){
"use strict"
var express = require('express')
, app = express()
, shoe = require('shoe')
, dnode = require('dnode')
, passport = require('passport')
, BrowserIDStrategy = require('passport-browserid').Strategy
, collections = ['peon-users']
, db = require("mongojs").connect('peons', collections)
@ashnur
ashnur / entry.js
Created October 27, 2012 20:42
client side script
void function(root){
"use strict"
var bean = require('bean')
, sizzle = require('sizzle')
, $ = function(selector, context, results){
results = sizzle(selector, context, results)
if ( results.length === 1 ) {
return results[0]
} else {
return results
@ashnur
ashnur / head.html
Created November 10, 2012 11:43
drupal shitty <head>
<head profile="http://www.w3.org/1999/xhtml/vocab">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="http://ldc.localhost/sites/all/themes/ldc2/favicon.ico" type="image/vnd.microsoft.icon" />
<meta content="Nyitólap" about="/nyitolap" property="dc:title" />
<meta name="generator" content="Drupal 7 (http://drupal.org)" />
<link rel="shortlink" href="/node/1" />
<link rel="canonical" href="http://ldc.localhost/" />
<title>Nyitólap | Lukács Dental Center</title>
<style type="text/css" media="all">@import url("http://ldc.localhost/modules/system/system.base.css?md6yha");
@ashnur
ashnur / template.php
Created November 14, 2012 13:07
drupal 7 issue
function ldc2_menu_link(array $variables){
$element = $variables['element'];
$sub_menu = '';
$element['#attributes']['class'][] = 'level-' . $element['#original_link']['depth'];
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);