Skip to content

Instantly share code, notes, and snippets.

View wallacemaxters's full-sized avatar

Wallace Maxters wallacemaxters

View GitHub Profile
<?php
function debug() {
while(ob_get_length() > 0) {
ob_end_clean();
}
echo '<pre style="color:#800">';
@wallacemaxters
wallacemaxters / console_log.php
Last active November 6, 2015 13:06
An easy way to debug PHP in console of browser
<?php
function console_log()
{
foreach (func_get_args() as $mixed) {
printf('<script>console.log(%s)</script>', json_encode($mixed));
}
}
@wallacemaxters
wallacemaxters / url_replace_query.php
Last active November 24, 2015 17:20
Replace query string of url based on passed array
<?php
if (! function_exists('url_replace_query'))
{
function url_replace_query($url, array $parameters)
{
$parts = parse_url($url) + [
'scheme' => 'http',
'query' => NULL,
'path' => NULL,
(function ($) {
var defaults = {
cache: false,
contentType: false,
processData: false,
type: 'POST',
onProgress: new Function,
xhr: function (xhr) {
/*!
* @author Gustavo Carmo
*/
(function ($) {
var finalInfo = {};
$.fn.jCropTec = function(options)
{
var $this = $(this);
@wallacemaxters
wallacemaxters / CSVReader.php
Last active November 25, 2015 11:22
A little csv reader class for php
<?php
class CSVReader implements SeekableIterator
{
const DEFAULT_DELIMITER = ',';
const DEFAULT_ENCLOSURE = '"';
const DEFAULT_ESCAPE = '\\';
@wallacemaxters
wallacemaxters / getUserMedia.js
Created November 25, 2015 12:44
Cross browser of GetUserMedia
function getUserMedia () {
return (navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia).apply(navigator, arguments)
}
(function ( $ ) {
function userMedia()
{
var n = navigator,
args = arguments;
return (n.getUserMedia ||
n.webkitGetUserMedia ||
n.mozGetUserMedia ||
(function ($) {
var emptyFunc = new Function;
var defaults = {
type: 'confirm',
data: {},
elements: {
container: 'wm-modal',
header: 'wm-modal-header',
@wallacemaxters
wallacemaxters / jquery-simulate-key-press.js
Created December 4, 2015 16:37
Simulate key press in element with jQuery
(function ($){
$.fn.triggerKeyPress = function (keys)
{
var keydownEvent = $.Event("keydown");
var $self = this;
$.each(keys, function(index, value) {