Skip to content

Instantly share code, notes, and snippets.

@elsassph
elsassph / index.php
Last active February 21, 2023 12:18
Create a VoiceChatAPI room from Slack
<?php
// first create a new voice chat room:
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query(array()),
)
@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 / 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 / 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 / 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 / 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_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 / 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 / JQ.hx
Created June 29, 2012 05:53
jQuery shorthand for haxe 'using'
class JQ
{
static public inline function select(j:js.Dom.HtmlDom):js.JQuery
{
return new js.JQuery(j);
}
static public inline function query(j:String):js.JQuery
{
return new js.JQuery(j);
@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