This file contains hidden or 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 | |
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" | |
# word="${TM_SELECTED_TEXT}${TM_CURRENT_WORD}" | |
echo selected: ${TM_SELECTED_TEXT}, word: ${TM_CURRENT_WORD} |
This file contains hidden or 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
218.22.148.105 - - [03/May/2017:13:12:17 +0200] "GET /?author=5 HTTP/1.1" 404 50082 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0" | |
114.69.233.82 - - [03/May/2017:13:12:55 +0200] "GET /?author=6 HTTP/1.1" 404 50082 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0" | |
193.239.233.236 - - [03/May/2017:13:13:33 +0200] "GET /?author=7 HTTP/1.1" 404 50082 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0" | |
218.90.148.177 - - [03/May/2017:13:14:11 +0200] "GET /?author=8 HTTP/1.1" 404 50082 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0" | |
61.158.188.21 - - [03/May/2017:13:14:51 +0200] "GET /?author=9 HTTP/1.1" 404 50082 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0" | |
155.4.33.255 - - [03/May/2017:13:15:27 +0200] "GET /?author=10 HTTP/1.1" 404 50082 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0" | |
119.93.25.17 |
This file contains hidden or 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
alias glb="git reflog | grep checkout | cut -d\ -f6,8 | sed 's/ /\n/' | head -n50 | "' awk '\''!x[$0]++'\'' '" | egrep [g-z] | head -n8" |
This file contains hidden or 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 (result) { | |
if (result.success) { | |
// do things with result.data | |
}else{ | |
alert(message); // or modal notify, or ... | |
} | |
console.log(debug); | |
} |
This file contains hidden or 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
# prompt | |
export PS1="[\u@\h:\w]\[\e[1;32m\]\$(current_git_repository)\[\033[0m\]\$ " | |
# function used in prompt | |
function current_git_repository { | |
local branch=`git branch 2>/dev/null | grep ^\* | cut -b3-`; | |
local star=''; | |
if [ "$branch" != '' ]; then | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && star='*' || star=''; | |
echo "[$branch$star]" |
This file contains hidden or 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
var yadda = (function() { | |
var myObject = {}; | |
var pubVar = 123; | |
var privVar = 456; | |
var someDefaultOptions = {}; | |
function public1() { | |
// ... | |
return 'allKindsOfInterestingStuff'; | |
} |
This file contains hidden or 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
/* | |
We have a table with read/write permissions for every User Role / Object Type / Object Property. | |
When adding a new Property to an object we often copy the rights from an existing, similar property, with this query: | |
*/ | |
INSERT INTO rights (roleId, strType, strProperty, `read`, `write`) | |
SELECT roleId, strType, newProperty, `read`, `write` | |
JOIN (SELECT 'new property one' AS newProperty UNION SELECT 'new property two' UNION SELECT 'new property three') | |
FROM rights | |
WHERE strType = 'phdRegistrations' | |
AND strProperty = 'existingProperty'; |
This file contains hidden or 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
// having turned input into an array.. | |
// Levenshtein 0.04 seconds | |
for ($i=0; $i < 250; $i++) { | |
for ($j=$i+1; $j < 250; $j++) { | |
if (levenshtein($input[$i], $input[$j]) == 1) { | |
echo $input[$i].':'.$input[$j]."\n"; | |
} | |
} | |
} |
This file contains hidden or 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 = explode("\n", file_get_contents('3.txt')); | |
$count = count($input); | |
echo $count. " inputs\n"; | |
foreach ($input as $i => $line) { | |
preg_match('/#(\d+) @ (\d+),(\d+): (\d+)x(\d+)/', $line, $m); | |
$rects[$m[1]] = ['x'=>$m[2], 'y'=>$m[3], 'x2'=>$m[2]+$m[4], 'y2'=>$m[3]+$m[5]]; | |
} | |
$filled = []; |
This file contains hidden or 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 | |
$q = $_GET['q']; | |
$googStump = "https://www.google.com/search?q="; | |
$gooogle = $googStump.rawurlencode($q); | |
// custom keys | |
$keys = [ | |
'hn' => 'https://news.ycombinator.com/', | |
]; |