Skip to content

Instantly share code, notes, and snippets.

@danschumann
danschumann / gist:9708266
Last active August 29, 2015 13:57
recursive menu
var
html, printRecord, entry, n;
// records is an array of objects with parent_id, name and id attributes
// [ {parent_id: ..., id: ..., name: ...}, ...]
html = '';
printRecord = function(parent_id){
html +='<ul>';
@danschumann
danschumann / gist:9880857
Last active August 29, 2015 13:57
yea node is blocking, but in weird cases like this, you can defer
// from this
app.get('/', function(req, res){
for(var i = 0; i<100000; i++) {
console.log(i); // your code here
}
res.send(true);
@danschumann
danschumann / Step 1 -- Backend .js
Last active January 4, 2021 16:39
How to pass an object from nodejs to frontend
myObject = { ... }
this.injectString = JSON.stringify( myObject ).replace(/\\/g, '\\\\').replace(/"/g, '\\\"')
@danschumann
danschumann / _readme.md
Created September 19, 2014 20:12 — forked from shime/_readme.md

I forked this to remember it easier

Having trouble installing the latest stable version of tmux?

Save yourself some time and run this little fellow!

Prerequisities

  • gcc
@danschumann
danschumann / gist:a003c2d55dd83c3e550c
Last active August 29, 2015 14:09
Google's material spec - resort bootstraps list-group
class ResortableInstance
sort: (e) ->
@$('.controller-icons .glyphicon').addClass 'disabled'
isUp = $(e.currentTarget).hasClass('glyphicon-arrow-up')
isDown = $(e.currentTarget).hasClass('glyphicon-arrow-down')
return unless isUp or isDown
$li = $(e.currentTarget).parents('.list-group-item:first')
@danschumann
danschumann / gist:34841fb65e9eaf625139
Last active August 29, 2015 14:10
Coffeescript react class wrapper
diagnoser = null
$ =>
(diagnoser = new Diagnoser).renderTo $(".diagnoser")[0]
console.log "DIAG", diagnoser
class ReactClass
value: 'asdf123'
birth: (Class) =>
@danschumann
danschumann / gist:cb832f6341aa697e58cb
Last active June 17, 2016 17:31
html canvas text addons
Canvas = require('canvas')
_ = require('underscore')
Canvas.Context2d::fillTextCircle = (text, x, y, radius, letterSpacing, angle, reverse, letterSpacingFlat, maxAngle) ->
if _.isObject text
{
text
x
y
@danschumann
danschumann / description.md
Last active August 29, 2015 14:16
Tampermonkey Script

Google Calender Easy Add Appointments

This script is made for tamper monkey. it creates an additional button next to create that pops up a window with 3 select boxes.

Currently it is set up so my trainer can pick this week|next week, day of week, 4:45pm|4:30pm. The main reason for this is because entering 4:45pm takes too many clicks.

TO use:

  • In tampermonkey, include https://www.google.com/calendar/render* for the page
  • Paste the script
" Plugin manager.. auto download if not already ( re launch vim a few times )
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plugin manager.. auto download if not already ( re launch vim a few times )
call plug#begin('~/.vim/plugged')
Plug 'michaeljsmith/vim-indent-object'
@danschumann
danschumann / dashedLines.poly.coffee
Last active July 6, 2016 15:32
Dashed lines poly for canvas
_moveTo = CanvasRenderingContext2D::moveTo
_lineTo = CanvasRenderingContext2D::lineTo
_save = CanvasRenderingContext2D::save
_restore = CanvasRenderingContext2D::restore
keys = ['_lineDash', '_lineDashSegment', '_lineDashTime', '_lineDashActive', '_lineDashLast']
CanvasRenderingContext2D::save = ->
@['_saved' + k] = @[k] for k in keys