Skip to content

Instantly share code, notes, and snippets.

// doesn't work
App.ApplicationView = Ember.View.extend({
didInsertElement: function() {
$(document).foundation();
}
});
// works
App.ApplicationView = Ember.View.extend({
didInsertElement: function() {
//
// HTML
//
<html>
<head></head>
<body class="loading"></body>
</html>
//
// Template (layout.hbr)
@tilleps
tilleps / gist:5974119
Created July 11, 2013 09:51
CanJS jQuery.fn.control
//
// CanJS jQuery.fn.control
//
// http://canjs.com/docs/jQuery.fn.control.html
//
// The jQuery.fn.control method do not appear to work with string parameter
//
//
// Define Plugin
@tilleps
tilleps / whiteboard-cleaner.sh
Created February 9, 2015 00:22
Whiteboard Cleaner Script
#!/bin/bash
# Whiteboard cleaner: http://ipestov.com/one-cool-gist-whiteboardcleaner/
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2
@tilleps
tilleps / gist:77c0721485a105e0e37230d8c867c66d
Created April 28, 2016 18:20
VueJS data() being called twice on load
var Component = Vue.extend({
template: "<div>Hello world</div>",
data: function () {
console.log('Component data()');
return {};
},
ready: function () {
function test(a = foo(arguments)) {
console.log(a, typeof a);
}
function foo(args) {
console.log('foo', args)
}
console.log(test(undefined, undefined, undefined));
@tilleps
tilleps / strict-routing.js
Created January 13, 2020 06:30
ExpressJS strict routing workaround
/*
Enforcing strict routing
https://github.com/expressjs/express/issues/2281
Use cases:
GET /strict -> noslash
GET /strict/ -> noslash (expect slash)
GET /strict// -> noslash (expect 404)
<body>
<div style="display: flex; flex-direction: column; min-height: 100vh; ">
<div style="flex-shrink: 0; overflow: auto;">
HEADER
</div>
<div style="flex-shrink: 0; overflow: auto;">
<div style="margin: 0 auto; align-self: center; overflow: auto; max-width: 420px; padding: 1rem 2rem; border-radius: 0.5rem; background: #eee;">
BANNER
</div>
</div>
@tilleps
tilleps / gist:d79a5213f59d4931c7cfc0e977477b3e
Last active February 29, 2020 06:17
Alternative to Git Squash
# https://stackoverflow.com/a/3143485/2424549
# create a new branch
git checkout -b new_clean_branch
# apply all changes
git merge original_messy_branch
# forget the commits but have the changes staged for commit
git reset --soft master
<html>
<head>
<style>
* {
margin: 0;
}
</style>
</head>
<body>
<div style="display: flex; flex-direction: column; min-height: 100vh;">