Skip to content

Instantly share code, notes, and snippets.

View jjaffeux's full-sized avatar

Joffrey JAFFEUX jjaffeux

View GitHub Profile
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@tracked reply = 'default';
}
import Component from "@ember/component";
import { action } from "@ember/object";
export default Component.extend({
time: "forever",
loved: false,
showSomeLove: Ember.computed("loved", "time", function() {
return this.loved ? true : false;
}),
@jjaffeux
jjaffeux / components.my-composer\.js
Last active April 24, 2020 12:51
hash creates new object
import Component from "@ember/component";
export default Component.extend({
hashOptionsChanged: Ember.observer("hashOptions.foo", function() {
console.log(
"hashOptions changed",
"guid for hashOptions: " + Ember.guidFor(this.hashOptions),
"guid for hashOptions.foo: " + Ember.guidFor(this.hashOptions.foo)
);
}),
@jjaffeux
jjaffeux / controllers.application.js
Last active July 19, 2019 15:10
Ember.computed.reads
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
foo: null,
bar: Ember.computed.alias("foo"),
init() {
this._super(...arguments);

Keybase proof

I hereby claim:

  • I am jjaffeux on github.
  • I am joffrey (https://keybase.io/joffrey) on keybase.
  • I have a public key ASBNNrMoOGf_J4sVQPMFZEHAxlE-LgPx2H2cFbVK-_ZhtQo

To claim this, I am signing this object:

@jjaffeux
jjaffeux / img_bench.ruby
Last active May 26, 2017 14:26
benchmark image optim solution
require 'base64'
require 'benchmark'
require 'fileutils'
sample_base64_images = [
"iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAMAAABiM0N1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAACxMAAAsTAQCanBgAAAGkUExURUdwTLlsCrl1FA0JAtKFDRALAgsIAlQ2CLV1EwkHAc6FCyAVBQYFAbZ4ELd1Dq93ESUWA0onBGE8C69uDKNSBygUArJzD8eCDsd/DMyCColKC3E4BXdNC7ZvC4dODIVQC3lDCykOAv/UPF8QA/3OL/qpDSoTBP/RN/zIKf/WRf/ZO/7ZUf/faPqxEf7bXv70x/vAJv////agDPSXC/GABRcDAPKIB/mzGv/icv/tqv/rofq5IPvDH//qmfKQCfq6F//jfv6/MiMJAP/ws/WlEvzUMvisGP+XI//xuv7zwP+OJPp9BP7HNv7ljf6gC/+gKORvBW8QBP+HI7ofH/+zLv7ohP/kWVg8Fz4mFM8uLPvMUfjNOv/gSP7tkeM3N/T3+m1PIf+pLPradjIOBOfs8fuNBKqfnYRoLcnW4eebE7tXD0wNAe28Mdnf5d2JEpx1H7CHJrK1u4gqEOutJ/7sPdWrK72hSe8+PsGhJPh5BD4HAIpwRstqEE87NOnLUmdUTXhsaY5+dX9ZHb3I0//205waF+LJPPlCQ5yNhKWUJ9a+cv1ERljKUBcAAAAidFJOUwDxHkDuLGkNORvRllJuhlG115W0+tKhpZO46vJ00c633fik2umpAAAHuElEQVRYw+3Y+Vva6BYH8CoIAu61Vbvd+1BkCcsggqCIGmRTo7iwCagsMghFFhFccO+obeefvue8iQtKrfa3O898qQEh+XjOmzch6atX/+YflubW9o7+vgGxWDzQ19/R2Sz8PaWzX8wv53LhcFgHP7lyRjzQ3vpiprVfnCmHE7ZRz18kf3hG5xNMmT
# add dancing_woman
require "active_support/core_ext/object/blank"
require "active_support/core_ext/hash/deep_merge"
require "base64"
require "fileutils"
require "image_optim"
require "json"
require "nokogiri"
require "open-uri"
@jjaffeux
jjaffeux / disqus_amp_BR
Created May 12, 2017 13:30
disqus_amp_BR
<div id="disqus_thread"></div>
<script>
window.addEventListener('message', receiveMessage, false);
function receiveMessage(event)
{
if (event.data) {
var msg;
try {
msg = JSON.parse(event.data);
} catch (err) {
@jjaffeux
jjaffeux / keybase
Created June 2, 2015 19:53
keybase
### Keybase proof
I hereby claim:
* I am jjaffeux on github.
* I am joffrey (https://keybase.io/joffrey) on keybase.
* I have a public key whose fingerprint is 60E5 A821 DA96 05A9 EE99 7E85 DD42 1157 AF02 F266
To claim this, I am signing this object:
@jjaffeux
jjaffeux / moodstoock_with_a_twist.js
Created October 9, 2013 08:23
moodstoock_with_a_twist
$(document).ready(function () {
$.ajax({
url: "/usercount",
type: "GET",
dataType: "text"
}).done(function (data) {
$({
nb_developers: 0
}).animate({
nb_developers: data