Skip to content

Instantly share code, notes, and snippets.


Yan Sern yansern

View GitHub Profile
yansern / SqlServerGrammar.php
Created Feb 15, 2018
SqlServerGrammar with OFFSET..FETCH support
View SqlServerGrammar.php
namespace Illuminate\Database\Query\Grammars;
use Illuminate\Support\Arr;
use Illuminate\Database\Query\Builder;
class SqlServerGrammar extends Grammar
yansern / gulpfile.js
Created Dec 4, 2016 — forked from Falconerd/gulpfile.js
Gulp + Watchify + Babelify + BrowserSync
View gulpfile.js
* This gulpfile will copy static libraries and a index.html file as well as
* merge, babelify and uglify the rest of the javascript project.
* - Separate media, libs and src with different watchers.
* - Media and libs should only be copied to dist if they are different sizes.
* The expected project is to be laid out as such:
View gist:26f3873d997f34537172
var wordList = [
View normalise-path.php
* Normalise a file path string so that it can be checked safely.
* Attempt to avoid invalid encoding bugs by transcoding the path. Then
* remove any unnecessary path components including '.', '..' and ''.
* @param $path string
* The path to normalise.
* @param $encoding string
yansern / gist:86eb5a02454217b3cef9
Created Aug 21, 2014
McDonalds WiFi KeepAlive script (not working)
View gist:86eb5a02454217b3cef9
USER_MAC=$(ifconfig en1 | grep ether | sed 's/.*ether //g' | awk -F: '{printf("%02s:%02s:%02s:%02s:%02s:%02s",$1,$2,$3,$4,$5,$6)}')
OUTLET_MAC=$(arp $(route get default | grep gateway | sed 's/ gateway: //g') | sed 's/.* at //g' | sed 's/ on.*//g' | awk -F: '{printf("%02s-%02s-%02s-%02s-%02s-%02s",$1,$2,$3,$4,$5,$6)}')
PHPSESSID=$(curl -I -G --max-redirs 0 --data $POST_DATA | grep PHPSESSID | sed 's/.*PHPSESSID=//g' | sed 's/.*PHPSESSID=//g' | sed 's/\;.*//g')
echo $COOKIE
curl '' -H $COOKIE -H 'Origin:' -H 'Content-Type: application/x-www-form-urlencoded' --data $POST_DATA
yansern / gist:4ff8478d179689960f15
Created Jun 6, 2014
Selector Function Extension
View gist:4ff8478d179689960f15
defaultOptions: {
"{comment}": "[data-comment]"
function(self) { return {
comment: {
remove: function(id) {
yansern / gist:2ea7077236a1245c397a
Last active Aug 29, 2015
Image Fill Strategy (XOR Table)
View gist:2ea7077236a1245c397a

Image Fill Strategy

AND Tall Viewport (<1) Square Viewport (=1) Wide Viewport (>1)
Tall Image (<1) fit-height fit-width fit-width
Square Image (=1) fit-height fit-width/fit-height fit-width
Wide Image (>1) fit-height fit-height fit-width
You can’t perform that action at this time.