Skip to content

Instantly share code, notes, and snippets.

View m93a's full-sized avatar
🥔
omw to start a commune

Michal m93a

🥔
omw to start a commune
View GitHub Profile
@m93a
m93a / depend.js
Last active August 29, 2015 14:02
A simple dependency manager
(function(){
var defConst = function(obj,prop,val){
Object.defineProperty(obj,prop,{
"value": val
});
};
var _libs = {};
@m93a
m93a / index.html
Created October 17, 2014 21:48
Konvertor RGB barev
<!document html>
<html>
<head>
<meta charset=utf-8 />
<title>Převod barev</title>
<style>
input{
font-family: Courier New;
}
@m93a
m93a / index.html
Created December 4, 2014 18:46
HTML6 default namespace - shorter and backwards compatibile
<!--
- Very often, solution of the problem that
- bothers us is in fact very simple and
- already used in XML.
- ~~m93a
-->
<!-- typical html6 -->
<!doctype foo>
<html:html>
@m93a
m93a / index.html
Last active August 29, 2015 14:10
HTML6 microformats - semantic web gets even better
<!--
-
- Vote for this idea on http://hlasov.at/lg0i
-
-->
<!-- html5 with microformats -->
<!doctype html>
<html>
<head></head>
@m93a
m93a / libSession.php
Created March 23, 2015 18:02
Safe PHP sessions extension
<?php
//Drobné rozšíření k PHP sessions
function session_exists($id=false) {
$sid = '';
if($id) {
$sid = $id;
} elseif(session_id()) {
$sid = session_id();
} elseif($_GET['SID']) {
:: Launcher for the Windows Photo Viewer dll
rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll",ImageView_Fullscreen %~1
:: "THE BEER-WARE LICENSE" (Revision 42):
:: <michal@grno.cz> wrote this file. As long as you retain this notice you
:: can do whatever you want with this stuff. If we meet some day, and you think
:: this stuff is worth it, you can buy me a beer in return.
@m93a
m93a / example.js
Created September 5, 2015 12:58
Advanced anchor-pivot switching support for every DisplayObject
//create some dummy containers & sprites
var container = new PIXI.Container;
var sprite1 = new PIXI.Sprite(texture);
sprite1.position = new PIXI.Point(0,0);
sprite1.width = 20;
sprite1.height = 20;
var sprite2 = new PIXI.Sprite(texture);
sprite2.position = new PIXI.Point(100,0);
@m93a
m93a / enviro.js
Last active December 26, 2015 13:29
A simple and customizable high-level JS framework
(function(){
//Shortands for global variables
window.win = window;
window.doc = win.document;
window.on = win.addEventListener;
window.rmon = win.removeEventListener;
//Underscore function
@m93a
m93a / engine.js
Last active December 26, 2015 13:29
Hexgrid game engine
//http://www.redblobgames.com/grids/hexagons/
(function(){
win.World = {
"map": [],
"xy": function(x,y){
if(!World.map[x]){return false;}
if(this.map[x][y]){
return this.map[x][y];
}else{
return false;
@m93a
m93a / LV Haack nose cone.js
Created February 28, 2017 15:40
This computes the radius of a LV Haack nose cone at each point
function LVHaack(n){
n=+n;
with(Math){
return sqrt( 1/PI * ( acos(1-n/12) - 0.5*sin(2*acos(1-n/12)) + (1/3)*pow(sin(acos(1-n/12)),3) ) )
}
}
/* For LD Haack change `(1/3)*pow` to `0*pow`,
for tangent Haack change it to `(2/3)*pow` */