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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"time" | |
) | |
const numWorkers = 3 |
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
#!/usr/bin/env bash | |
if [ $EUID -ne 0 ]; then | |
echo "You must be root: \"sudo ngxdis\"" | |
exit 1 | |
fi | |
# -z str: Returns True if the length of str is equal to zero. | |
if [ -z "$1" ]; then | |
echo "Please choose a site." |
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 | |
// custom validator in laravel to validate comma separated emails. | |
\Validator::extend("emails", function($attribute, $values, $parameters) { | |
$value = explode(',', $values); | |
$rules = [ | |
'email' => 'required|email', | |
]; | |
if ($value) { | |
foreach ($value as $email) { |
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
#!/bin/bash | |
echo "--------------------------------------------------------------------------------------------" | |
echo "Installing Predis on Ubuntu 16.04" | |
echo "Read more: https://github.com/nrk/predis" | |
echo "Author: Ralf Rottmann | @ralf | http://rottmann.net" | |
echo "--------------------------------------------------------------------------------------------" | |
PHP_CONF_DIR="/etc/php/7.0/apache2/conf.d" | |
echo "Checking prerequisites..." | |
echo "Git available?" | |
[ ! -s /usr/bin/git ] && sudo apt-get -q -y install git || echo "Git already installed." |
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\Models; | |
use Auth; | |
use Illuminate\Database\Eloquent\Model as BaseModel; | |
class Model extends BaseModel | |
{ | |
protected $userAttributes = []; |
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
/* | |
I created the following javascript to use bootstrapt's notifications through Javascript. | |
If you like it you may consider adding it to bootstrapt. Feel free to modify if necessary. | |
Be sure you define a div #notification-area, where the notifications are going to be displayed by default. | |
I use it with jQuery 1.7.1 but it should work with older versions. Is also use jquery.hotkeys.js ( https://github.com/jeresig/jquery.hotkeys ) for block messages hotkeys | |
*/ | |
(function( $ ){ | |
var pub = { |
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
.input-recaptcha { | |
width:172px; | |
} |
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 ($) { | |
/* Twitter Bootstrap Message Helper | |
** Usage: Just select an element with `alert` class and then pass this object for options. | |
** Example: $("#messagebox").message({text: "Hello world!", type: "error"}); | |
** Author: Afshin Mehrabani <[email protected]> | |
** Date: Monday, 08 October 2012 | |
*/ | |
$.fn.message = function(options) { | |
//remove all previous bootstrap alert box classes | |
this[0].className = this[0].className.replace(/alert-(success|error|warning|info)/g , ''); |
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 ($) { | |
/* Twitter Bootstrap Message Helper | |
** Usage: Just select an element with `alert` class and then pass this object for options. | |
** Example: $("#messagebox").message({text: "Hello world!", type: "error"}); | |
** Author: Afshin Mehrabani <[email protected]> | |
** Date: Monday, 08 October 2012 | |
*/ | |
$.fn.message = function(options) { | |
//remove all previous bootstrap alert box classes | |
this[0].className = this[0].className.replace(/alert-(success|error|warning|info)/g , ''); |
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
jQuery(function($) { | |
$('form[data-async]').live('submit', function(event) { | |
var $form = $(this); | |
var $target = $($form.attr('data-target')); | |
$.ajax({ | |
type: $form.attr('method'), | |
url: $form.attr('action'), | |
data: $form.serialize(), |
NewerOlder