Skip to content

Instantly share code, notes, and snippets.

View Markavian's full-sized avatar

Markavian Markavian

View GitHub Profile
@Markavian
Markavian / gist:39f858306cde040e5775
Created October 7, 2014 18:39
Finally... a .htaccess file that routes correctly on my localhost and the server?
DirectoryIndex site/php/routes/index.php?path=index
<IfModule mod_rewrite.c>
Require all granted
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mkv25.net$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*)$ site/php/routes/index.php?path=$1 [NC,L,QSA]
@Markavian
Markavian / freedom.md
Created October 8, 2014 21:04
Freedom

I personally believe that people have the right to do whatever they please, so long as that freedom does not restrict the freedoms of others.

That goes to say, I think people can and should point out if they think other people are wrong, or hold incorrect views, but ultimately, I am sympathetic to both sides in an argument - both sides should be empowered to take their stance, and do what they please as a result.

If people want to expend time and energy telling other people what to do and think, then go right ahead. Like I am doing now by writing this post.

@Markavian
Markavian / Pointer.hx
Last active August 29, 2015 14:08
Soft reference type : Pointer<T> - that can be easily serialized. For use when you need a reference to an object in a different domain, where this domain requires serialization, and the referenced object should not form part of this domain's serialization tree. Hxpect specs for this class here: https://gist.github.com/Markavian/4baad5dee4448e1ef8b8
package net.mkv25.base.core;
import haxe.ds.StringMap;
/**
* Soft reference type : Pointer<T> - that can be easily serialized
* For use when you need a reference to an object in a different domain, where this domain requires serialization, and the referenced object should not form part of this domain's serialization tree.
*/
class Pointer<T>
{
package net.mkv25.specs;
import hxpect.core.BaseSpec;
import net.mkv25.base.core.Pointer;
class PointerSpecs extends BaseSpec
{
override public function run()
{
describe("Pointers", function()
@Markavian
Markavian / elevatorsaga.js
Last active August 29, 2015 14:14
Final solution for play.elevatorsaga.com - up to challenge #17. Requires mode switching between stopAtRequests = true or false depending on scenario.
{
init: function(elevators, floors) {
var stopAtRequests = false;
var sharedRequestList = [];
Array.prototype.contains = function(obj) {
var i = this.length;
while (i--) {
if (this[i] === obj) {
@Markavian
Markavian / example.html
Last active August 29, 2015 14:22
Make strapdown work with embedded markdown tags...
<!DOCTYPE html>
<html>
<head>
<title>Embedded Markdown</title>
</head>
<body>
<markdown>
# Markdown text goes in here
@Markavian
Markavian / harness.js
Created July 15, 2015 21:08
Seemingly Broken Pretty Diff Ouput
function compare() {
// Compare
var prettydiff = require("prettydiff");
var fs = require('fs');
var args = {
source: './tests/compiler/build/*.component.js',
diff: './tests/compiler/canned',
lang: 'html'
};
var report = prettydiff.api(args);
@Markavian
Markavian / main.js
Last active September 27, 2016 18:33
var sum = require('./sum');
console.log(sum(2,5), 'should equal 7');
function makeLogger() {
return new winston.Logger({
level: 'info',
transports: [
new (winston.transports.Console)(),
new (winston.transports.File)({ filename: 'somefile.log' })
]
});
}
@Markavian
Markavian / filter.js
Created November 27, 2016 23:19
r/a/dio favourites played in the past 24 hours
var favesData = require('./mkv25_faves.json');
var faves = favesData.map((item) => {
var copy = Object.assign({}, item);
copy.lastplayeddate = new Date(item.lastplayed);
copy.lastplayedts = Math.round(copy.lastplayeddate.getTime() / 1000);
return copy;
});
var ts = Math.round(new Date().getTime() / 1000);