Skip to content

Instantly share code, notes, and snippets.

@arsonus
arsonus / galera-mysqlnd_ms.md
Created March 24, 2017 00:36 — forked from denji/galera-mysqlnd_ms.md
Clustered DB Replication

php module mysqlnd_ms

mysqlnd_ms.enable = On
mysqlnd_ms.config_file = /etc/mysqlnd_ms_plugin.ini
mysqlnd_ms.multi_master = On
mysqlnd_ms.collect_statistics = On
mysqlnd_ms.force_config_usage = On
@arsonus
arsonus / html-editors.md
Created January 30, 2017 09:28 — forked from manigandham/rich-text-html-editors.md
List of rich text / HTML editors
@arsonus
arsonus / 1.js
Created January 21, 2017 05:23 — forked from chrisbuttery/1.js
Fade in / Fade out
// fade out
function fade(el) {
var op = 1;
var timer = setInterval(function () {
if (op <= 0.1){
clearInterval(timer);
el.style.display = 'none';
}
el.style.opacity = op;
@arsonus
arsonus / php_object_to_array.php
Created November 1, 2016 21:06 — forked from victorbstan/php_object_to_array.php
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@arsonus
arsonus / README.md
Created October 17, 2016 20:20 — forked from magnetikonline/README.md
Compile ssh2 bindings extension for PHP7.

Compile ssh2 bindings extension for PHP7

The current PHP ssh2 extension via PECL won't compile under PHP7.

Using a more recent version via PHP's GitHub we can make this work.

$ sudo apt-get install autoconf libssh2-1-dev
$ curl -LO https://github.com/php/pecl-networking-ssh2/archive/master.zip
$ unzip master.zip
$ cd pecl-networking-ssh2-master
@arsonus
arsonus / nginx-cors.conf
Created October 3, 2016 19:29 — forked from algal/nginx-cors.conf
nginx configuration for CORS (Cross-Origin Resource Sharing), with an origin whitelist, and HTTP Basic Access authentication allowed
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
@arsonus
arsonus / cryptographically_secure_random_strings.php
Created September 17, 2016 01:48 — forked from raveren/cryptographically_secure_random_strings.php
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer:http://stackoverflow.com/a/13733588/179104
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'hexdec':
@arsonus
arsonus / twitter.php
Created August 16, 2016 22:55 — forked from Wol/twitter.php
Twitter Analytics PHP Downloader
<?php
$sTarget = "https://analytics.twitter.com/user/$username/tweets/export.json?start_time=$start_time&end_time=$end_time&lang=en";
$sTargetBundle = "https://analytics.twitter.com/user/$username/tweets/bundle?start_time=$start_time&end_time=$end_time&lang=en";
curl_setopt($ch, CURLOPT_URL, $sTarget);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, false);
@arsonus
arsonus / url_slug.js
Last active May 23, 2016 17:49 — forked from sgmurphy/url_slug.js
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <[email protected]>
@arsonus
arsonus / Object.watch.js
Created May 15, 2016 02:41 — forked from XoseLluis/Object.watch.js
Polyfill for the Object.watch/Object.unwatch functions available in Mozilla browsers
/*
Polyfill for the Object.watch/Object.unwatch functions available in Mozilla browsers
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/watch
you have a test here:
http://www.telecable.es/personales/covam1/deployToNenyures/SourceCode/Object.watch.test.js
and can read more here:
http://deploytonenyures.blogspot.com.es/2013/02/objectwatch-polyfill.html
*/