Skip to content

Instantly share code, notes, and snippets.

View ochafik's full-sized avatar

Olivier Chafik ochafik

View GitHub Profile
@ochafik
ochafik / variable_pattern.scad
Last active January 30, 2021 14:02
Some stress test for lazier unions
// Copyright 2021 Google LLC.
// SPDX-License-Identifier: Apache-2.0
//
/*
This model exercices a few experimental features I've been brewing.
It's not a theoretical case tho: I was trying to print a chainmail with
variable tiles when OpenSCAD's rendering scalability challenges hit me hard :-S
(guess I fell down the rabbit hole of 3d rendering optimization at the
temporary expense of my 3d printing projects, oh well!)
@ochafik
ochafik / README.md
Last active February 3, 2022 01:27
Build an optimized OpenSCAD locally on MacOS X (checkout parallel fork)
mkdir build
( cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DEXPERIMENTAL=1 )
( cd build && time make -j12 )
( cd build/tests && time ctest -j12 -E 'edges_view-options-tests|nef3_broken' )
( cd build/tests && time ctest -j12 -R 'fastcsg.*' )
@ochafik
ochafik / test.dart
Last active February 4, 2020 14:26
dart:js doesn't unwrap IntersectionObserver
import 'dart:js';
import 'dart:html';
main() {
printJsObject(o) =>
(JsObject(context['Function'], ['console.log(arguments[0])']) as JsFunction).apply([o]);
printJsObject(DivElement());
// prints <div></div>
@ochafik
ochafik / main.dart
Created February 4, 2020 14:18
dart:js IntersectionObserver unwrapping bug
import 'dart:js';
import 'dart:html';
main() {
printJsObject(document.body);
var o = IntersectionObserver((entries, observer) {
printJsObject(observer);
printJsObject(JsObject.fromBrowserObject(observer));
for (final entry in entries) {
printJsObject(entry);
@ochafik
ochafik / burkini.md
Created August 26, 2016 05:18
Opinion(Burkini été 2016): Délit de terrorisme vestimentaire passif: à qui profite la persécution religieuse?

Délit de terrorisme vestimentaire passif: à qui profite la persécution religieuse?

Toute ressemblance avec l'affaire du racolage passif serait purement fortuite.

Ne nous voilons pas la face: en matière de politique publique, ce n'est pas l'intention qui compte, ce sont les résultats.

Eh bien quid justement des intentions en jeu dans l'affaire du burkini, et des résultats probables?

Je vois grosso modo 3 profils majeurs pour nos bien-intentionnés amis anti-burkini:

@ochafik
ochafik / serve.py
Last active June 18, 2016 14:22
Dart Development Server
#!/usr/bin/env python
# https://gist.github.com/ochafik/9929ec51d3c4d3d613b71b5f5b45130b
# For SPDY / HTTP2 push: https://github.com/eigengo/opensourcejournal/blob/master/2014.1/spdynetty/spdynetty.md
import getopt
import os
import re
import sys
import threading
import urllib
@ochafik
ochafik / move_ddc_runtime_js_to_dart.sh
Created December 13, 2015 20:05
move_ddc_runtime_js_to_dart.sh
# {rtti,types,classes,errors,generators,operations,runtime}
for lib in rtti types classes errors generators operations runtime ; do
#_internal/compiler/js_lib/runtime.dart
js=lib/runtime/dart/_$lib.js
dart=tool/input_sdk/private/$lib.dart
if [[ ! -f $dart || "$FORCE" == "1" ]]; then
# ( cat $js | grep '\.\.\.' > /dev/null ) ||
cat $js | \
# egrep -v '^ exports.' |
egrep -v "'use strict'" | \
/**
* Gets a property descriptor for a target instance, skipping its class
* and walking up the super-classes hierarchy.
*
* @private
* @param {!Object} target
* @param {!string} name
* @return {!Object.<ObjectPropertyDescriptor>|undefined}
*/
$jscomp.getSuperPropertyDescriptor_ = function(target, name) {
@ochafik
ochafik / template.html
Created September 4, 2015 14:15
skygular
<!--
Widget build() {
return new Scaffold(
toolbar: buildToolBar(),
body: buildBody()
);
}
}-->
<paper-scaffold>
<paper-header-panel>
@ochafik
ochafik / functions.js
Last active August 27, 2015 14:30
Experiment on Closure Compiler's function types (behaviour of all '*' vs. unknown '?')
// Run with:
// java -jar compiler.jar --language_in=ECMASCRIPT6_STRICT -O ADVANCED --warning_level VERBOSE functions.js
/**
* @param {function(*)} f1 ERROR
* @param {function(*):*} f2 ERROR
* @param {function(?):*} f3
* @param {function(*):?} f4 ERROR
* @param {function(?):?} f5
* @param {function()} f6 ERROR