This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ $(id -u) -ne 0 ]] | |
then echo "Script requires sudo!" | |
exit 1 | |
fi | |
add-apt-repository ppa:ondrej/php5 | |
add-apt-repository ppa:ondrej/mysql-5.6 | |
apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Middleware; | |
use App\Movie; | |
use Carbon\Carbon; | |
use Closure; | |
use Illuminate\Http\Response; | |
use Illuminate\Session\Store; | |
class CountMovieVisits { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB::listen(function($sql, $bindings) { | |
$sql = str_replace(['%', '?'], ['%%', '%s'], $sql); | |
var_dump(vsprintf($sql, $bindings)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('socket', function ($rootScope) { | |
var socket = io.connect(); | |
return { | |
on: function(event, callback) { | |
socket.on(event, function () { | |
var args = arguments; | |
$rootScope.$apply(function () { | |
callback.apply(socket, args); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get (url, callback) { | |
var request = new XMLHttpRequest(); | |
request.onreadystatechange = function () { | |
if (request.readyState == 4 && request.status == 200) | |
callback(request.responseText) | |
} | |
request.open('GET', url, true) | |
request.send() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inspired by http://stackoverflow.com/a/6033994 | |
// for better visual performance hide fading elements via css not via js | |
$.fn.fadeAlternately = function (options) { | |
var options = options || {}; | |
var defaults = { | |
timeOn: 500, | |
timeOff:100, | |
fadeInSpeed:1500, | |
fadeOutSpeed:1500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.9.1/ember.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.0.0-beta.14.1/ember-data.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Paginates an array of data in accordance with how many items are on page | |
* and page currently viewed. | |
* | |
* @param array $data Array of data to paginate. | |
* @param int $perPage Number of items to display per page. | |
* @param int $currentPage Page number currently viewed. | |
* @return array | |
*/ | |
function paginate(array $data, $perPage, $currentPage = null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
$this->app->validator->resolver(function($translator, $data, $rules, $messages) | |
{ | |
return new GoogleReCaptchaValidator($translator, $data, $rules, $messages); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User { | |
protected $name; | |
public function __construct($name) | |
{ | |
$this->name = $name; | |
} |
OlderNewer