Skip to content

Instantly share code, notes, and snippets.

@Petah
Petah / index.php
Last active January 31, 2016 15:57
2-cms
<?php
$view = preg_replace('/[^a-z]/', '', $_SERVER['REQUEST_URI']) ?: 'index';
require __DIR__ . '/layout.php';
<?php
set_time_limit(0);
/* ----------------------------- CONFIG -----------------------------*/
$master_server = "dev2.muvik.tv";
$file_server = 1;
// -- API MASTER
define('MASTER_CONVERT_RESULT', 'http://'.$master_server.'/api/convert_result/dota2/', true);
define('MUVIK_GET_TASK', 'http://'.$master_server.'/api/task/dota2/?', true);
@volter9
volter9 / MooQuery.js
Created November 13, 2014 23:31
Better than jQuery
var MooQuery = function (query) {
this.elements = Array.prototype.splice.call(document.querySelectorAll(query), 0);
};
MooQuery.prototype = {
constructor: MooQuery,
each: function (callback) {
this.elements.map(callback);
},
};
@celbaz
celbaz / gist:3b74d888101848ab9d1c
Created November 13, 2014 23:27
Recursive Deep Copying (Ruby)
class Array
def deep_dup
self.map do |el|
if !el.is_a? Array
el
elsif self.none? {|el| el.is_a? Array}
el.map {|el2| el2}
else
el.deep_dup
function hasClass(selector,str){
var el = document.querySelector(selector);
var className = el.className();
var classArray = className.split(' ')
if(classArray.indexOf(str) !== -1){
return true;
}
return false;
}
@sarciszewski
sarciszewski / wp-api.txt
Created October 29, 2014 00:02
Go Home, WP-API, You're Drunk...
... or more accurately, asleep at the wheel!
_______________________________________________________
_________/ STORY TIME (feel free to skip this if you don't care) \__________
| |
| Recently, I made a quick analysis of all of the public projects listed |
| on HackerOne. https://gist.github.com/sarciszewski/04ee71ad2bcddc9c33b9 |
| |
| If you scroll to the bottom, I listed several projects in the "sweet |
| spot": open source AND a minimum bounty. Outside of the Internet Bug |
| Bounty project, there are only two projects listed: WP-API and Ian Dunn (a |

Quick install PHP 7.0:

1. Install depends PHP 7.0
$ brew install autoconf automake gmp homebrew/versions/bison27 gd freetype t1lib gettext zlib mcrypt
2. Configure PHP 7.0
$ git clone --depth=1 https://github.com/php/php-src.git

$ cd php-src

@volter9
volter9 / multidimensional.php
Last active August 29, 2015 14:04
Two functions to manipulate multi-dimensional arrays
<?php
/**
* Two functions to work with multidimensional arrays.
* md_get to get array value using key separated by '.'
* md_set to set array value using key separated by '.'
* Easy, huh?
*
* @author volter9
*/
@gustavohenke
gustavohenke / svg2png.js
Created February 18, 2014 15:27
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
var Promise = function(wrappedFn, wrappedThis) {
this.then = function(wrappedFn, wrappedThis) {
this.next = new Promise(wrappedFn, wrappedThis);
return this.next;
};
this.run = function() {
wrappedFn.promise = this;
wrappedFn.apply(wrappedThis);
};