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
// remove from array, no seq | |
// https://jsperf.com/array-remove-by-index | |
var arr = [1,2,3] | |
var index = arr.indexOf(2) | |
arr[index] = arr[arr.length - 1] | |
arr.pop() |
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
/** | |
1. bookmark any page in mobile | |
2. edit bookmark into below js as "eruda" | |
3. go to desired debug page | |
4. url bar tap "erude" and click the bookmarked link | |
*/ | |
javascript:(function () { var script = document.createElement('script'); script.src="//cdn.jsdelivr.net/npm/eruda"; document.body.appendChild(script); script.onload = function () { eruda.init() } })(); |
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
# download as mp4, playlist also | |
function youtube-dl-mp4() { | |
youtube-dl -f "[height <=? 720][tbr>500]" --yes-playlist $1 | |
} | |
# download as mp3 | |
function youtube-dl-mp3() { | |
youtube-dl -x --audio-format mp3 --add-metadata $1 | |
} |
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
# pull latest with stash | |
function gitup() { | |
git stash -u | |
git pull --rebase | |
git stash pop | |
} | |
# stash staged | |
function gitstash() { | |
git stash push -m $1 -- $(git diff --staged --name-only) |
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
# save disk space, screen no need png | |
defaults write com.apple.screencapture type jpg;killall SystemUIServer |
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 ( | |
"bytes" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"net/http" | |
"strings" | |
) |
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 findgo() { | |
find $GOPATH/src -mindepth 3 -maxdepth 3 -type d -exec ls -ld "{}" \; | grep $1 | awk '{ print $9 }' | nl | |
} | |
findgo gogo | |
function cdgo() { | |
r=$(findgo $1) | |
echo $r | |
printf 'cd to ? > ' |
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 dropbox | |
import ( | |
"bytes" | |
"encoding/json" | |
"errors" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
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
javascript:(function(){if(!($=window.jQuery)){script=document.createElement("script");script.src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";script.onload=a;document.body.appendChild(script)}else{a()}function a(){var b=function(){var e="";for(var d=0;d<32;d++){e+=Math.floor(Math.random()*15).toString(15)}return e.substr(0,15)};var c=$("#registration-form");c.find("#id_first_name").val(b());c.find("#id_last_name").val(b());c.find("#id_email").val(b()+"@gmail.com");c.find("#id_username").val(b());c.find("#id_password1").val(b());c.find("#id_legal").attr("checked",true);c.submit()}})(); |
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
MATCH (b:Book) | |
WHERE ANY ( tag IN b.tags WHERE tag IN ['nosql','neo4j'] ) | |
RETURN b.title,b.tags | |
SKIP 20 | |
ORDER BY b.title DESC | |
LIMIT 20 | |
------------ | |
MATCH (b:Book)<-[r:Votes]-(:User) |