Skip to content

Instantly share code, notes, and snippets.

Philippe elsassph

View GitHub Profile
@elsassph
elsassph / no-sponsor.js
Created Feb 17, 2020
Hide Facebook sponsored stories
View no-sponsor.js
// ==UserScript==
// @name No sponsor
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hide Facebook sponsored stories
// @author You
// @match https://www.facebook.com/
// @grant none
// ==/UserScript==
@elsassph
elsassph / 1-profile.ps1
Last active Dec 12, 2019
PowerShell profile
View 1-profile.ps1
# Git prompt
Import-Module posh-git
$GitPromptSettings.EnableFileStatus = $false
# $GitPromptSettings.DefaultPromptAbbreviateGitDirectory = $true
# Apply Mac PATH and declare project shortcuts
. ~/LoadPath.ps1
# nvm
Set-NodeVersion 10
@elsassph
elsassph / minify-all.js
Created Mar 16, 2018
Run uglify-js on all the javascript files in a folder
View minify-all.js
// NOTE: run with `NODE_ENV=production` for optimal results
const fs = require('fs');
const path = require('path');
const UglifyJS = require('uglify-js');
// Path to process
const bin = './bin';
function onlyJS(files) {
@elsassph
elsassph / 0-readme.md
Last active Aug 30, 2016
Nginx single-page app local dev server config
View 0-readme.md

Easy single-page app dev using nginx

If you're using only nginx (no Apache thx) and want to serve your projects using a local dev domain.

Install nginx

brew install nginx

Or download/unzip for Win: http://nginx.org/en/docs/windows.html

@elsassph
elsassph / ResourceGenerator.hx
Created Jul 3, 2016
Haxe build macro converting a JSON file into strongly typed, inline/dce friendly, properties
View ResourceGenerator.hx
package;
#if macro
import haxe.Json;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
import sys.io.File;
import sys.FileSystem;
@elsassph
elsassph / 0_Test.hx
Last active Nov 26, 2017
Haxe macro for: custom, automatic, getter/setter generation
View 0_Test.hx
/*
We want to generate:
- getMyProperty / setMyProperty
- getAnotherProperty
- getYetAnotherProperty / setYetAnotherProperty
*/
class Test implements Proxied
{
public var MyPoperty(default, default):Int;
@elsassph
elsassph / 0-Example.hx
Last active May 25, 2016
Haxe - use macro to generate dispatch code
View 0-Example.hx
/*
Automatically generate dispatch functions as:
public function onDoubleArguments(one:String, two:Int) {
for (listener in listeners)
listener.onDoubleArguments(one, two);
}
*/
class Example extends Dispatcher<Dynamic>
{
@elsassph
elsassph / 1-loop-es6.js
Last active Dec 5, 2016
ES2015 / babel vs Haxe code generation
View 1-loop-es6.js
const a = [1,2,3];
var acc = 0;
for (const v of a) {
acc += v;
}
// want clean code? use Array.reduce
console.log(acc);
View poop.js
Array.prototype.poop = function() {
this.pop();
// return nothing, it's poop
}
Array.prototype.shit = function() {
this.shift();
// return nothing, it's poop
}
@elsassph
elsassph / Module1.hx
Last active Dec 29, 2015
One approach to building Haxe JS modules - EDIT: see https://github.com/elsassph/modular-haxe-example
View Module1.hx
package modules;
class Module1
{
static public function main()
{
trace("Module1 is loaded");
var m1 = new Module1();
}
You can’t perform that action at this time.