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
double t = 0.0; | |
const double dt = 0.01; | |
double currentTime = hires_time_in_seconds(); | |
double accumulator = 0.0; | |
State previous; | |
State current; | |
while ( !quit ) |
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
/*global gmap */ | |
function getUserLocation(map) { | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function (position) { | |
var point = new google.maps.LatLng(position.coords.latitude, | |
position.coords.longitude); | |
if (typeof getUserLocation.user_marker == 'undefined') { | |
getUserLocation.user_marker = new google.maps.Marker({ | |
position:point, |
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
### Keybase proof | |
I hereby claim: | |
* I am pawel-dubiel on github. | |
* I am paweld (https://keybase.io/paweld) on keybase. | |
* I have a public key ASCpp9-PytysQjos85C369ICb2c50z_vQj9Y4-R-k6ZifQo | |
To claim this, I am signing this object: |
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
alias babel-node='babel-node --presets stage-0' | |
------ RECV ------ | |
// babel-node recv2.js "#" | |
// babel-node recv2.js "kern.*" | |
const amqp = require('amqplib'); | |
const args = process.argv.slice(2); | |
if (args.length == 0) { |
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
//use script not recommended in es6 modules | |
export {average, sort_by_ranking_desc}; | |
let items = [],max_test_items=10; | |
for ( let i=0;i<max_test_items;i++) { | |
items[i] = { name: "foo", ranking: Math.random() }; | |
} | |
let sort_by_ranking_desc = (a, b) => (b.ranking-a.ranking ); |
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
function $(id) { return document.getElementById(id); } | |
function byClass (el, cl) { return el ? el.getElementsByClassName(cl) : [] } | |
function byTag (el, tg) { return el ? el.getElementsByTagName(tg) : [] } | |
function allof (cl) { return byClass(document, cl) } | |
function hasClass (el, cl) { var a = el.className.split(' '); return find(cl, a) } | |
function addClass (el, cl) { if (el) { var a = el.className.split(' '); if (!find(cl, a)) { a.unshift(cl); el.className = a.join(' ')}} } | |
function remClass (el, cl) { if (el) { var a = el.className.split(' '); rem(a, cl); el.className = a.join(' ') } } | |
function html (el) { return el ? el.innerHTML : null; } | |
function attr (el, name) { return el.getAttribute(name) } | |
function tonum (x) { var n = parseFloat(x); return isNaN(n) ? null : n } |
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
get last top 10 ips from access log ( last 10000 requests ) | |
tail -n 10000 access.log | awk '{print $1}' | sort | uniq -c | sort -n | tail -n 10 |
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 | |
require_once 'app/Mage.php'; | |
Mage::app("default"); | |
/** | |
* | |
* SELECT DISTINCT(status) FROM sales_flat_order ; |
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
console.log("got here"); | |
var page = require('webpage').create(); | |
page.onConsoleMessage = function(msg) { | |
console.log(msg); | |
}; | |
page.open("http://facebook.com", function(status) { | |
if ( status === "success" ) { |
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
// from http://mndlss.com/2011/05/rk4-in-javascript/ | |
/** EXAMPLE SETUP | |
**************************************************/ | |
var ball = document.getElementById("ball") | |
, container = document.getElementById("cont") | |
, halfWidth = container.clientWidth / 2 | |
, halfHeight = container.clientHeight / 2 | |
, mouseUp = true | |
; | |
container.style.background = "rgb(185,195,159)"; |
NewerOlder