Skip to content

Instantly share code, notes, and snippets.

View njoyard's full-sized avatar

Nicolas Joyard njoyard

View GitHub Profile
@njoyard
njoyard / gist:11304191
Created April 25, 2014 21:37
fluent-ffmpeg size/padding attempt 1
function getScalePadFilters(width, height, aspect, color) {
/*
let a be the input aspect ratio, A be the requested aspect ratio
if a > A, padding is done on top and bottom
if a < A, padding is done on left and right
*/
return [
/*
@njoyard
njoyard / deputes.md
Last active January 15, 2016 12:13
Permanences des députés depuis nosdeputes.fr

Pour regénérer:

	var deputes = JSON.parse(document.body.firstChild.innerHTML).deputes;
	document.body.innerHTML = '<pre>'
	+ deputes.sort(function(a, b) {
		return a.depute.nom_de_famille.localeCompare(b.depute.nom_de_famille);
	}).map(function(dep) {
{"api_root_url": "http://www.nosdeputes.fr/api/document/Amendement/", "id_step": "02_1èrelecture_assemblee_hemicycle", "sujets": {"Article 1er ter": {"titre": "Article 1er ter", "details": "article 1er ter", "amendements": [{"sort": "adopté", "groupe": "ECOLO", "id_api": "120697", "numero": "23", "aut": "M. Coronado, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "NI", "id_api": "120699", "numero": "304", "aut": "M. Fromantin", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "NI", "id_api": "120695", "numero": "357", "aut": "M. Fromantin", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120700", "numero": "649", "aut": "M. Krabal, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120901", "numero": "652", "aut": "M. Krabal, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120696", "numero": "653", "aut": "M. Krabal, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120698", "numero": "65
{"api_root_url": "http://www.nosdeputes.fr/api/document/Amendement/", "id_step": "02_1èrelecture_assemblee_hemicycle", "sujets": {"Article 1er ter": {"titre": "Article 1er ter", "details": "article 1er ter", "amendements": [{"sort": "adopté", "groupe": "ECOLO", "id_api": "120697", "numero": "23", "aut": "M. Coronado, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "NI", "id_api": "120699", "numero": "304", "aut": "M. Fromantin", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "NI", "id_api": "120695", "numero": "357", "aut": "M. Fromantin", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120700", "numero": "649", "aut": "M. Krabal, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120901", "numero": "652", "aut": "M. Krabal, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120696", "numero": "653", "aut": "M. Krabal, …", "date": "2016-01-18"}, {"sort": "non-voté", "groupe": "RRDP", "id_api": "120698", "numero": "65
@njoyard
njoyard / controllers.application.js
Last active February 12, 2019 11:07
Double component render test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@njoyard
njoyard / controllers.application.js
Last active February 12, 2019 11:06
Double render test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@njoyard
njoyard / controllers.application.js
Last active February 12, 2019 12:13
Double component render test
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@njoyard
njoyard / tlp-ac.log
Created February 28, 2019 20:11
Test results on Arch on a Thinkpad x270, with possibly some config remaining from 1.1.
--- TLP 1.1.907 --------------------------------------------
+++ Configured Settings: /etc/default/tlp
TLP_ENABLE=1
TLP_DEFAULT_MODE=AC
TLP_PERSISTENT_DEFAULT=0
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
@njoyard
njoyard / controllers.application\.js
Created October 29, 2020 17:30
EmberArray autotracking
import { A } from '@ember/array';
import Controller from '@ember/controller';
import { action } from '@ember/object';
export default class ApplicationController extends Controller {
items = A([]);
get even() {
return this.items.length % 2 === 0;
}