Skip to content

Instantly share code, notes, and snippets.

@elsassph
elsassph / no-sponsor.js
Created February 17, 2020 17:47
Hide Facebook sponsored stories
// ==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 April 5, 2022 09:17
PowerShell profile
# Load dev projects paths as variables
~/LoadPath.ps1
# Rust
$Env:PATH += ":$($Env:HOME)/.cargo/bin"
# Java 1.8
#$Env:JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/"
# Java 11
$Env:JAVA_HOME="/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home"
@elsassph
elsassph / minify-all.js
Created March 16, 2018 09:05
Run uglify-js on all the javascript files in a folder
// 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 August 30, 2016 07:07
Nginx single-page app local dev server config

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 July 3, 2016 13:21
Haxe build macro converting a JSON file into strongly typed, inline/dce friendly, properties
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 November 26, 2017 18:36
Haxe macro for: custom, automatic, getter/setter generation
/*
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 20:04
Haxe - use macro to generate dispatch code
/*
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 December 5, 2016 23:37
ES2015 / babel vs Haxe code generation
const a = [1,2,3];
var acc = 0;
for (const v of a) {
acc += v;
}
// want clean code? use Array.reduce
console.log(acc);
@elsassph
elsassph / poop.js
Last active October 18, 2021 13:45 — forked from edankwan/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 December 29, 2015 14:08
One approach to building Haxe JS modules - EDIT: see https://github.com/elsassph/modular-haxe-example
package modules;
class Module1
{
static public function main()
{
trace("Module1 is loaded");
var m1 = new Module1();
}