Skip to content

Instantly share code, notes, and snippets.

View nabinno's full-sized avatar
🤞
Draw and draw and draw

nabinno

🤞
Draw and draw and draw
View GitHub Profile
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) { // DONE
if (xhr.status == 200) { // OK
alert(xhr.responseText);
} else {
alert("status = " + xhr.status);
}
}
}
// GET
ssh -t foo@bar /bin/zsh --login -c "screen"
C:\cygwin\bin\mintty.exe -i "/Cygwin-Terminal.ico" -t Mintty /bin/zsh.exe --login -c "screen"
Google Drive URL:
https://drive.google.com/file/d/$foo
Open URL:
https://googledrive.com/host/$foo
[core]
excludesfile = ~/.gitignore_global
[alias]
# export to $1 which is supposed to be a dirname (it does the same as copying repo and removing .git)
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
ammend = commit --amend
a = add -v
b = branch
br = branch
branches = branch -a
(global-set-key "\C-cw" 'cb-copy)
(global-set-key "\C-cy" 'cb-paste)
(defun cb-copy ()
(interactive)
(let ((coding-system-for-write 'shift_jis-dos))
(shell-command-on-region (region-beginning) (region-end) "cat > /dev/clipboard" nil nil nil))
(message ""))
(defun cb-paste ()
(interactive)
(let ((coding-system-for-read 'shift_jis-dos))
@nabinno
nabinno / delete-newline.js
Created August 31, 2014 07:41
google apps script of deleting newline for google spreadsheets
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function deleteNewline() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
for i in `find . -name "*.html" | xargs grep -l "foo"` ; do
cp $i $i.org`date +%y%m%d` ;
sed 's/foo/bar/g' $i.org`date +%y%m%d` > $i ;
done
for i in {1..100};
do;
case $(($i%3)) in;
0)echo Fizz;
case $(($i%5)) in;
0)echo Buzz;;
esac;;
*)echo $i;;
esac;
done
function rename () {
for i in *$1* ; do
\mv $i `echo $i | sed -e s,$1,$2,g`
done
}
alias rn="rename"
# recusively
function rename-recursively () {
find . | while read file ; do