Skip to content

Instantly share code, notes, and snippets.

me@redacted:~$ python
Python 2.7.3 (default, Mar 14 2014, 11:57:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>
[1]+ Stopped python
me@redacted:~$ ps
PID TTY TIME CMD
24815 pts/1 00:00:00 bash
@ef4
ef4 / gist:82f37eb5dae4e56467b6
Created June 16, 2014 21:13
Example Application Cache "Bootloader"
(function(){
function useManifest(content){
var tag;
var stylesheets = content.match(/\/css\/.*\.css/g);
for (var i=0; i<stylesheets.length; i++){
tag = document.createElement('link');
tag.href = stylesheets[i];
tag.rel = "stylesheet";
document.getElementsByTagName('head')[0].appendChild(tag);
@ef4
ef4 / gist:fe2e8e5b6e75266e3c2d
Last active September 3, 2020 12:48
Gist as iframe
<iframe src="data:text/html;charset=utf-8,%3Cbody%3E%3Cscript%20src%3D%22https%3A%2F%2Fgist.github.com%2Fef4%2Ffe2e8e5b6e75266e3c2d.js%22%3E%3C%2Fscript%3E%3C%2Fbody%3E">
init();
animate();
function init() {
var output = document.createElement( 'div' );
output.style.cssText = 'position: absolute; left: 50px; top: 300px; font-size: 100px';
document.body.appendChild( output );
var tween = new TWEEN.Tween( { x: 50, y: 0 } )
.to( { x: 400 }, 2000 )
@ef4
ef4 / gist:def026cf7b03a2e1e183
Last active October 19, 2016 00:08
route vs resource in Ember route map
// "route" and "resource" are almost interchangeable. Both of these work fine:
this.route('people', function(){
this.route('person', {path: '/:person_id'})
})
this.route('people', function(){
this.resource('person', {path: '/:person_id'})
})
this.route('flowers', function() {
this.route('index');
this.route('error')
this.route('new');
this.route('flower', { path: "/:flower_id" });
});
export default Ember.Component.extend({
didInsertElement: function() {
this.canvas = new fabric.Canvas(this.get('element'));
this.drawSomeStuffUsingCanvas();
},
updateSomething: Ember.observer('someField', function(){
// Change canvas to reflect 'this.someField'
})
})

Keybase proof

I hereby claim:

  • I am ef4 on github.
  • I am ef4 (https://keybase.io/ef4) on keybase.
  • I have a public key whose fingerprint is A5EA B010 448C D0B9 FD2A 287C 9E15 33D7 5A7D 3120

To claim this, I am signing this object:

@ef4
ef4 / app_components_my-button.js
Last active April 7, 2017 01:35
Yielding Actions
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button',
click: function() {
// In Ember 2.0, actions are just regular functions passed as
// parameters to components. You will be able to invoke them
// by just calling them, like this:
var action = this.get('action');
if (action) {
@ef4
ef4 / .emacs
Created April 27, 2015 17:31
Flycheck with JSCS
;; Flycheck JSCS
(flycheck-def-config-file-var flycheck-jscs javascript-jscs ".jscs.json"
:safe #'stringp)
(flycheck-define-checker javascript-jscs
"A JavaScript code style checker.
See URL `https://github.com/mdevils/node-jscs'."
:command ("jscs" "--reporter" "checkstyle"
(config-file "--config" flycheck-jscs)
source)
:error-parser flycheck-parse-checkstyle