View pre-commit.lint
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/sh | |
# | |
# Hook script to check the changed files with php lint | |
# Called by "git commit" with no arguments. | |
# | |
# To enable this hook, rename this file to "pre-commit". | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD |
View random_image.php
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 | |
function randomImage(int $width, int $height) | |
{ | |
$image = imagecreatetruecolor($width, $height); | |
for($row = 1; $row <= $height; $row++) { | |
for($column = 1; $column <= $width; $column++) { | |
$red = mt_rand(0,255); | |
$green = mt_rand(0,255); | |
$blue = mt_rand(0,255); | |
$colour = imagecolorallocate ($image, $red , $green, $blue); |
View gist:6d6a86685e19a65edcdf1a689ccc000a
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
General | |
# 2×× - Success | |
## 200 - OK | |
Hopefully most your responses | |
## 202 - Accepted | |
Used in [/post/api/v1/orders](API-Reference#post-apiv1orders) when the order needs to be confirmed via email verification. | |
[More](https://httpstatuses.com/202) |
View assertValid.php
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
/** | |
* Asserts a single value passes on one ore many laravel validation rules. | |
* | |
* @param array|string $rule | |
* @param mixed $value | |
*/ | |
protected function assertValid($rule, $value) | |
{ | |
$rules = [ |
View gist:f99c2b1f688cf6999c25
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
git branch | grep arcpatch | xargs git branch -D |
View Reset form with jQuery
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($){ | |
$.fn.reset = function(fn) { | |
return fn ? this.bind("reset", fn) : this.trigger("reset"); | |
}; | |
})(jQuery); |
View pagination.jade
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
-// example pagination object | |
- var p = {current: 4, total: 10} | |
-// actual template | |
.paginationcontrol | |
- if(p.current > 1) | |
a.page.page-first(href=util.urlHelper({p:null})) << | |
a.page.page-prev(href=util.urlHelper({p:(p.current - 1)!=1?(p.current - 1): null})) < | |
- else | |
span.page.disabled.page-first << | |
span.page.disabled.page-prev < |
View get_set_url_param.js
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 getURLParameter(name) { | |
return decodeURIComponent( | |
(RegExp('[?|&]'+name + '=' + '(.+?)(&|$)').exec(location.search)||[null,null])[1] | |
); | |
} | |
function setURLParameter(name,value){ | |
var search; | |
if(getURLParameter(name)){ | |
search =location.search.replace(new RegExp('([?|&]'+name + '=)' + '(.+?)(&|$)'),"$1"+encodeURIComponent(value)+"$3"); | |
}else if(location.search.length){ |