Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Change the server address. Run in the /logs/ directory.
apihost="http://api.localhost";
logfile=$(ls -tr xmpp_* | tail -1);
# Dont edit below this line :)
vcard="";
# Using awk to flush every line separately to avoid buffering issues. I think.
tail -f "$logfile" | awk '{print $0; fflush()}' | while read -r line
PHPUnit 5.0.9 by Sebastian Bergmann and contributors.
........................EEEEFFFFFFFFFFF 39 / 39 (100%)
Time: 98 ms, Memory: 4.50Mb
There were 4 errors:
1) CalendArt\Adapter\Google\ApiErrorExceptionTest::testConstructWithParseException
Prophecy\Exception\Doubler\MethodNotFoundException: Method `Double\stdClass\P8::json()` is not defined.
@Sleavely
Sleavely / routes.php
Created November 6, 2016 17:15
List all Laravel routes
<?php
// List all routes as a prettyprinted JSON array.
// Compatible with Laravel 4 and 5.
Route::get('routes', function(){
$routes = Route::getRoutes();
$results = array();
foreach ($routes as $route)
{
$path = $route->getPath();
@Sleavely
Sleavely / updateProfileWithSessionExcerpt.js
Created January 13, 2017 12:22
Sample for Profile Cloud integrations
send_event = new inno.Profile.Event({
"definitionId" : definitionId,
"data" : {
"email" : email,
"urlroi" : urlRoi
}
});
send_session = new inno.Profile.Session({
"collectApp" : innoHelper.getCollectApp(),
{
"meta": {
"isNew": true,
"eventListenerId": "19012",
"profileSize": 6,
"companyId": "265",
"bucketId": "new-ic-training",
"appId": "benjamins-sandbox-jockes-profile-sample-app",
"requestMeta": {
"requestTime": 1484312910123,
(function () {
var newcss = '#myDiv { -webkit-filter: blur(8px) grayscale(1); }';
newcss += '#hideSomething { display: none; }';
newcss += '#makeItGreen { background: #00ff00; }';
if ('\v' == 'v') /* ie only */ {
document.createStyleSheet().cssText = newcss;
} else {
var tag = document.createElement('style');
tag.type = 'text/css';
@Sleavely
Sleavely / 1-callback-hell.js
Last active August 11, 2017 12:14
Callback hell be gone!
// An example in classic callback hell.
// In this example, talkToAPI uses a callback like we're used to
talkToAPI('login', function(err, res){
doStuff(res);
talkToAPI('getUser', function(err, res){
doStuff(res);
talkToAPI('extraData', function(err, res){
@Sleavely
Sleavely / dataLayer-observer.js
Created August 15, 2017 11:26
A nifty lil' snippet to wrap around .push() to observe what's being added to dataLayer.
console.log('dataLayer before injection', window.dataLayer);
(function(){
// Safeguard for sites that don't implement dataLayer or that haven't initialized it yet.
window.dataLayer = window.dataLayer || [];
// Keep a reference to the method we're overwriting
var existing_func = window.dataLayer.push;
window.dataLayer.push = function(){
var args = arguments;
Object.keys(args).forEach(function(key){