Skip to content

Instantly share code, notes, and snippets.

View jongacnik's full-sized avatar

Jon jongacnik

View GitHub Profile
@Superbil
Superbil / swf2svg.py
Created July 19, 2012 05:59
use pyswf to convert to svg
#!/usr/bin/python
import sys
if len(sys.argv) > 1:
file_name = sys.argv[1]
else:
print "no input file name"
exit()
from swf.movie import SWF
@bcole808
bcole808 / wp-router.php
Created June 2, 2015 20:54
WordPress PHP Router
<?php
######### router.php #########
#
# This file implements basic server routing and rewrite rules;
# Run the following command from the project root:
#
# php -S localhost:5000 -t path/to/wordpress path/to/router.php
#
# ^ hostname ^ root ^ server router
@jpwilliams
jpwilliams / regex.js
Last active September 29, 2016 08:14
Simple Markdown Single Regex
// Very simple regex that supports ```big code blocks```,
// `code highlights`, *bold*, _italic_ and ~strikethrough~,
// isolating each group.
/(`{3}([\S\s]+?)`{3})|(`(.+?)`)|(\*(.+?)\*)|(_(.+?)_)|(~(.+?)~)|(\n)|(.+?)/gm
@RickCarlino
RickCarlino / regex.md
Created March 20, 2014 20:38
Password Regex

Password Strength Regex

Ensures a password has...

  • One uppercase
  • One lowercase
  • One special character
  • Two digits
  • Length greater than 8
@nuxodin
nuxodin / php Scalar Type Hints.php
Last active December 14, 2016 23:11
I would welcome php like this
<?php
// Stirct types
function test(string $name, int $age, float $cuteness, bool $evil) {
//....
}
// Convert types
function test((string)$name, (int)$age, (float)$cuteness, (bool)$evil) {
//....
@shaunlebron
shaunlebron / getSvgFrames.js
Created December 11, 2013 03:26
Convert SWF animation to SVG frames.
/*
You can use this script with Google Swiffy to produce SVG frames from an SWF animation.
1. Upload your SWF file to Google Swiffy --> https://www.google.com/doubleclick/studio/swiffy/
2. Save the swiffy output HTML page locally.
3. Edit the page to include this script with <script src="getSvgFrames.js"></script>
4. Open the page in Firefox to see the SVG download links appear for each frame.
*/
(function(){
var url = window.location.pathname;
@sdepold
sdepold / LICENSE.txt
Created August 15, 2012 05:50 — forked from 140bytes/LICENSE.txt
140byt.es -- addObserverMethods
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Sascha Depold http://depold.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@rchrd2
rchrd2 / php_cache.php
Created June 3, 2017 22:38
Poor man's php cache. Saves to files. Includes expiry.
<?php
function add_cache($key, $value, $ttl) {
$dir = __DIR__.'/../cache/';
// Remove slashes for security
$filename = $dir . str_replace('/', '', $key);
// Store expiry in first line
$lines = [(string)(time() + (int)$ttl), $value ];
if (!file_exists($dir)) mkdir($dir, 0755, true);
file_put_contents($filename, implode("\n", $lines));
@dciccale
dciccale / README.md
Last active May 22, 2018 09:14
Cross-browser triggerEvent function done with 127 bytes of JavaScript

triggerEvent

Cross-browser function to trigger DOM events.

@cowboy
cowboy / ctor-return-function.js
Last active July 8, 2018 03:23
JavaScript: Constructor returning a "function" instance.
var util = require("util");
function Thing() {
// The instance is also a proxy function for its __default method.
var instance = function() {
return instance.__default.apply(instance, arguments);
};
// The instance needs to inherit from Thing.prototype.
instance.__proto__ = Thing.prototype;
// Initialize the instance with the __ctor method.