Skip to content

Instantly share code, notes, and snippets.

:octocat:
Out sick

Christopher Dosin ChristopherDosin

:octocat:
Out sick
Block or report user

Report or block ChristopherDosin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View promise-take-at-least.js
// Creates a new promise that automatically resolves after some timeout:
Promise.delay = function (time) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time)
})
}
// Throttle this promise to resolve no faster than the specified time:
Promise.prototype.takeAtLeast = function (time) {
return new Promise((resolve, reject) => {
@ChristopherDosin
ChristopherDosin / php_object_to_array.php
Created May 3, 2017 — forked from victorbstan/php_object_to_array.php
recursively cast a PHP object to array
View php_object_to_array.php
<?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);
@ChristopherDosin
ChristopherDosin / Manager.php
Created May 8, 2016 — forked from shyim/Manager.php
PHP - WebPush Manager
View Manager.php
<?php
namespace GSS\Component\Push;
use Symfony\Component\DependencyInjection\Container;
class Manager
{
const GCM_URL = 'https://android.googleapis.com/gcm/send/';
const MOZ_URL = 'https://updates.push.services.mozilla.com/push/v1/';
private $db;
View _ide_helper.php
<?php
/**
* An helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.0.16 on 2015-03-16.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
View example.html
// @foreach(array_chunk($posts->all(), 3) as $postSet)
@foreach(array_chunk($posts, 3) as $postSet)
<div class="row"> <!-- this div will surround every three posts -->
@foreach($postSet as $post)
<h3>{{ $post['title'] }}</h3>
@endforeach
</div>
@endforeach
View Laravel Ajax.js
jQuery( document ).ready( function( $ ) {
console.log("start");
$( '#form-add-setting' ).on( 'submit', function() {
//.....
//show some spinner etc to indicate operation in progress
//.....
console.log("Submitting");
$.post(
$( this ).prop( 'action' ),
You can’t perform that action at this time.