Skip to content

Instantly share code, notes, and snippets.

View cornedor's full-sized avatar
🚀
gotta go fast

Corné Dorrestijn cornedor

🚀
gotta go fast
View GitHub Profile
@cornedor
cornedor / comment.md
Last active August 29, 2015 14:19
Using "-->" as a single line comment.

Using "-->" as a single line comment.

Typing --> on the beginning of a line of code in JavaScript seems to comment it. But looks like there isn't almost no info available about this.

What i found so far is a v8 (test)[https://github.com/crosswalk-project/v8-crosswalk/blob/master/test/webkit/parser-xml-close-comment.js] that does test for this feature. So it looks like it is done intentionally.

Looks like v8 and Firefox's JS engine do both parse this correctly. MuJS does throw an syntax error

SyntaxError: test.js:2: unexpected token in expression: '>'
var i = 0;
function loop(callback)
{
if(++i > 10) return callback === undefined ? undefined : callback();
console.log(i);
setTimeout(function(){loop(callback);}, 200);
}
loop(function(){console.log('done');});
#!/bin/sh
SIZE="1920x1080"
BITRATE="32k"
FRAMERATE="20"
KEY="KEY_HERE"
TIMESTAMP=$(date "+%m-%d-%y-%H%M")
ffmpeg\
-f x11grab -s $SIZE -r $FRAMERATE -i :0.0\
-f alsa -ac 2 -i pulse\
-vcodec libx264 -preset ultrafast\
@cornedor
cornedor / WayToSimpleSlider.js
Created April 26, 2013 10:39
Way to simple slider.
var sidebarSlider = function() {
var frame = 0;
setInterval(function() {
frame++;
$("div#sidebarslider ul").css("margin-left", (-frame%1332) + "px");
}, 30);
}
// <div id="sidebarslider">
// <ul>
@cornedor
cornedor / gist:5476948
Created April 28, 2013 13:52
Mondriaan LD26 entry
package;
import flash.display.MovieClip;
import flash.display.CapsStyle;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.external.ExternalInterface;
import flash.Lib;
class Main extends MovieClip
@cornedor
cornedor / thumbnail.php
Created June 27, 2013 11:02
Crops images to a smaller or bigger size.
<?php
/**
* This classes allows you to create thumbnails. Input images will be resized,
* while the ratio keeps intact, and will cropped to the size given.
* @author Corné Dorrestijn
* @license http://www.gnu.org/copyleft/lesser.html GNU Library General Public License
* @package Default
*/
class Thumbnail
{
@cornedor
cornedor / gist:6591520
Last active December 23, 2015 06:08 — forked from anonymous/gist:6591494
<input id="yourinput" type="email" name="email" id="email" />
<script>
document.querySelector("#yourinput").addEventListener('click', function(e) {
console.log(e.target);
$(e.target).jeJqueryShit();
}, false);
</script>
@cornedor
cornedor / Main.hx
Created October 4, 2013 14:00
Exploding images
package;
import flash.display.BitmapData;
import flash.display.Loader;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.Lib;
import flash.net.URLRequest;
import flash.utils.Timer;
import flash.Vector;
import haxe.FastList;
@cornedor
cornedor / database.js
Last active December 25, 2015 00:09
A localStorage database-ish system written in JS
var database = (function () {
'use strict';
var tables = [],
dataCache = {},
toSync = 0,
DEBUG = true;
function log(t) {
if(DEBUG) {
console.log("%c" + t, "color: #090; font-weight: bold;");
}
@cornedor
cornedor / stylereloader.js
Last active December 29, 2015 15:19
Gets Last-Modified header from server and if changed reloads the style sheet.
(function(timeout, urls) {
var times = {};
setInterval(function() {
for(var i = 0; i < urls.length; i++) {
var x = new XMLHttpRequest(),
url = urls[i];
x.url = url;
x.open('HEAD', url + (url.indexOf("?") === -1 ? "?v=" : "&v=") + Date.now(), true);
x.onreadystatechange = function(e) {
var x = e.target;