Skip to content

Instantly share code, notes, and snippets.

View StephanHoyer's full-sized avatar
🏠
Working from home

Stephan Hoyer StephanHoyer

🏠
Working from home
View GitHub Profile
'use strict';
var m = require('mithril');
var isFunction = require('lodash/lang/isFunction');
var assign = require('lodash/object/assign');
var minMax = require('client/utils').minMax;
var content, targetDimensions, options, showTimer, isVisible;
function px(value) {
@StephanHoyer
StephanHoyer / filterinput.js
Created May 20, 2015 10:07
Select2-like mithril input
'use strict';
var m = require('mithril');
var icons = require('client/utils/icons');
var remove = require('lodash/array/remove');
var transform = require('lodash/object/transform');
var last = require('lodash/array/last');
var code = require('yields-keycode');
function sameAs(filterA) {
function updateTile(tile) {
if (tile.get('width')) {
tile.set('columnCount', (tile.get('width') + gutter) / columnToColumn);
}
tile.set('width', tile.get('columnCount') * columnToColumn - gutter);
return tile.save();
}
function updateTiles() {
// this is called
@StephanHoyer
StephanHoyer / Proposals.md
Last active December 24, 2015 06:19 — forked from it-ony/Proposals.md

Talk proposals for @leipzigjs usergroup

(In a non prioritized order)

  • flow.js - a synchron, asynchron control flow javascript library
  • inherit.js - a js inheritance library
  • xajax - perform cross-domain AJAX requests via iFrame and postMessage
  • query.js - an abstract query language which can be mapped to different query language implementations
  • jscop - static javascript code analyser written in node.js
'use strict';
var m = require('mithril');
var icons = require('client/utils/icons');
function controller() {
var scope = {
isPasswordVisible: false,
showPassword: function() {
scope.isPasswordVisible = true;
'use strict';
var omit = require('lodash/object/omit');
var extend = require('lodash/object/extend');
var m = require('mithril');
function apiUrl(type) {
return '/api/v1/' + type;
}
@StephanHoyer
StephanHoyer / checkbox.js
Created December 8, 2015 11:15
Simple multiselect with mithril.js
'use strict';
var m = require('mithril');
var icons = require('client/utils/icons');
function checkbox(label, options) {
options = options || {};
var onclick = function(event) {
event.stopImmediatePropagation();
options.onchange && options.onchange({
@StephanHoyer
StephanHoyer / base.js
Last active November 19, 2015 21:17
Basic example of a j2c-mithril integration - http://jsfiddle.net/qe805q4q/1/
var styler = require('./styler');
function mainView() {
return [
styler.view(),
//...
];
}
@StephanHoyer
StephanHoyer / inlineedit.js
Last active October 13, 2015 16:46
Inline edit mithril component
'use strict';
var m = require('mithril');
var extend = require('lodash').extend;
var setFocus = require('../util/viewhelper').setFocus;
var keymage = require('keymage');
function noop(){}
function addClass(el, className) {
@StephanHoyer
StephanHoyer / oojs.md
Last active October 13, 2015 16:45
Object orientation without new and the in JavaScript

Just saw Douglas Crockfords talk at Craft Conference

http://www.ustream.tv/recorded/46640057

Just tried it and must say, it has a certain beauty in it.

No tangeling with prototypes and this/that fuckup.

var Animal = function(name, legs) {