This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I really like the regex syntax of the rename perl script, e.g.: | |
rename "s/OldFile/NewFile/" OldFile* | |
I simply wanted the same thing with a copy command: | |
copy "s/OldFile/NewFile/" OldFile* | |
So here it is! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try.haxe.org lets you play with Haxe code examples. | |
Here's a plain Haxe->JS example: https://try.haxe.org/#94aC4 | |
OpenFL: | |
OpenFL has good docs, community, samples, and tutorials: | |
http://www.openfl.org/learn/docs/getting-started/ | |
http://www.openfl.org/learn/tutorials/ | |
Kha: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef ArtistsBackupRecord = { | |
artistid:Int, | |
name:String | |
} | |
class Main | |
{ | |
public static function main() | |
{ | |
var conn = sys.db.Sqlite.open("test.db"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require "open3" | |
require 'json' | |
require 'pathname' | |
require 'yaml' | |
# no trace TextField on the stage, please | |
defines = "-D native_trace" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Generate a private key and certificate signing request: | |
openssl genrsa -out ios_distribution.key 2048 | |
openssl req -new -key ios_distribution.key -out ios_distribution.csr -subj '/[email protected], CN=Example, C=US' | |
2) Upload CSR to apple at: https://developer.apple.com/account/ios/certificate/create | |
- choose Production -> App Store and Ad Hoc | |
3) Download the resulting ios_distribution.cer, and convert it to .pem format: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php header('content-type: application/json; charset=utf-8'); | |
# Curl / proxy parts of this script from: | |
# https://webster.cs.washington.edu/course-website/16au/lectures/slides/proxy.phps | |
$url = $_GET['src']; | |
$data = array(); | |
# Open the cURL session | |
$curlSession = curl_init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Math.random() wrapper with support for window.crypto.getRandomValues | |
// return a random number, 0 <= rand() < 1 | |
function rand() { | |
if (window.crypto && window.crypto.getRandomValues && (typeof Uint8Array=='function')) { | |
var buf = new Uint8Array(4); | |
window.crypto.getRandomValues(buf); | |
// buf = [0,0,0,0]; // 0 | |
// buf = [255,255,255,255]; // closest to 1 | |
// buf = [0,0,0,128]; // < 0.5 | |
// buf = [1,0,0,128]; // > 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on Modernizr webp basic test: | |
// https://github.com/Modernizr/Modernizr/blob/5eea7e2a213edc9e83a47b6414d0250468d83471/feature-detects/img/webp.js | |
// | |
// - Adds webp / no-webp classes to <body>, allowing loading of background images, e.g. scss: | |
// | |
// body.no-webp .hero-space { background-image: url(".../hero-space.jpg"); } | |
// body.webp .hero-space { background-image: url(".../hero-space.webp"); } | |
// | |
// - TODO: <img> lazyloading support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# create_self_extracting_script.sh <INPUT_FILE> [<OUTPUT_SCRIPT>] | |
# | |
# Creates a self-extracting shell script containing INPUT_FILE as Base64-encoded | |
# bytes. When executed, the script writes INPUT_FILE and restores its permissions. | |
# | |
# (c) Jeff Ward, 2017 | |
# MIT License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dump of LZW rendering engine for TIC by Deck. | |
References: | |
https://twitter.com/tic_computer/status/828312767677530112 | |
https://itch.io/t/60446/lzw-image-render | |
It always makes me nervous when I see code snippets in dropbox -- | |
the link can disappear anytime. So I encoded the dropbox ZIP into a | |
self-extracting bash script. |