Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.
Copy (replace) only the attached files to their respective directories. app/Exceptions/Handler.php
and app/Http/Middleware/Authenticate.php
# Laravel laravel-echo-server worker using systemd | |
# ---------------------------------- | |
# | |
# /etc/systemd/system/laravel-echo-server.service | |
# | |
# run this command to enable service: | |
# systemctl daemon-reload | |
# systemctl enable laravel-echo-server.service | |
# systemctl start laravel-echo-server.service |
<?php | |
namespace App\Providers; | |
use Illuminate\Support\Collection; | |
use Illuminate\Pagination\LengthAwarePaginator; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
public function boot() |
Configure PHP Lumen 5 HTTP Exception Handlers with common JSON responses.
Copy (replace) only the attached files to their respective directories. app/Exceptions/Handler.php
and app/Http/Middleware/Authenticate.php
import React, { Component } from 'react' | |
import { Router, Route, Link, IndexRoute, hashHistory, browserHistory, DefaultRoute } from 'react-router' | |
class App extends Component { | |
render () { | |
return ( | |
<Router history={hashHistory}> | |
<Route path='/' component={Container}> | |
<IndexRoute component={Home} /> | |
<Route path='address' component={Address} /> |
<?php | |
/** | |
* Send a Message to a Slack Channel. | |
* | |
* In order to get the API Token visit: | |
* | |
* 1.) Create an APP -> https://api.slack.com/apps/ | |
* 2.) See menu entry "Install App" | |
* 3.) Use the "Bot User OAuth Token" |
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/ | |
// See also: http://www.paulund.co.uk/change-url-of-git-repository | |
$ cd $HOME/Code/repo-directory | |
$ git remote rename origin bitbucket | |
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git | |
$ git push origin master | |
$ git remote rm bitbucket |
console.log("Before the first file is read."); | |
hypotheticalFileGetContents("sample.txt", function(fileContents){ | |
// fileContents now contains the file contents, this function is only called when the file read in the background has finished | |
console.log("After the first file has completed reading."); | |
}); | |
// You've now told it to start the first read, but it won't 'block' your script execution. It will do the read in the background, and immediately move on with the rest of your code. | |
console.log("Before the second file is read."); | |
hypotheticalFileGetContents("sample2.txt", function(fileContents){ |
<?php | |
// original source: http://kuwamoto.org/2007/12/17/improved-pluralizing-in-php-actionscript-and-ror/ | |
/* | |
The MIT License (MIT) | |
Copyright (c) 2015 | |
Permission is hereby granted, free of charge, to any person obtaining a copy |
#include <iostream> | |
#include <string> | |
#include <curl/curl.h> | |
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) | |
{ | |
((std::string*)userp)->append((char*)contents, size * nmemb); | |
return size * nmemb; | |
} |