Skip to content

Instantly share code, notes, and snippets.

View tuantranf's full-sized avatar
🎯
Focusing

Tuan (Mike) Tran tuantranf

🎯
Focusing
View GitHub Profile
@tuantranf
tuantranf / jsdoit.css
Created March 9, 2013 16:18
print out effect jquery
* {
margin: 0;
padding: 0;
border: 0;
}
body {
background: #fdf;
font: 30px sans-serif;
}
@tuantranf
tuantranf / jsdoit.css
Created March 9, 2013 16:23
zoom in image
#jquery-ui-transfer {
position:absolute;
top:0px; left:0px;
width: 300px;
height: 400px;
background: url("http://jsrun.it/assets/x/6/D/V/x6DVX.jpg");
background-size:300px 400px;
background-repeat:no-repeat;
}
.ui-effects-transfer {
@tuantranf
tuantranf / jsdoit.html
Created March 14, 2013 04:09
iPhone/Android/PC 対応。jQuery で書くタッチイベント
<!-- jQuery を読み込んでおいてね -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<div id="hoge" style="position:absolute; cursor:move; z-index:1; border:1px solid #FFF; background-color: rgb(51, 51, 51);">
????<img src="http://blog.fenrir-inc.com/jp/images/fenrir_dev_blog.png" width="90" height="90">
<p style="margin:0; font-size:10px; color:#FFF;" id="status">aaaa</p>
</div>
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
@tuantranf
tuantranf / AppleScript-error-memo
Last active August 29, 2015 14:14
AppleScript error number -1708
```
applescript error number -1708
doesn’t understand the the clipboard message. number -1708 from ....
```
Solution: running the 10.8.4 combo update
Ref:
https://discussions.apple.com/thread/5132915?tstart=0
AppleScript is supposed to redirect the command to the current application for compatibility with earlier versions. Did this start after a software update or something? You might try running the 10.8.4 combo update, which tends to clean things up a little bit better than the delta update.
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
@tuantranf
tuantranf / base64.js
Created January 21, 2016 07:16 — forked from whatnickcodes/base64.js
How to Encode and Decode Strings with Base64 in JavaScript
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
@tuantranf
tuantranf / osx-setup.sh
Created March 8, 2016 00:07 — forked from somebox/osx-setup.sh
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
@tuantranf
tuantranf / chatwork-to-all-helper.user.js
Created March 17, 2016 08:47 — forked from asonas/chatwork-to-all-helper.user.js
Chatworkが新しくバージョンアップしたことによるDOM構造の追随を施した。 使い方とかは https://gist.github.com/haruta/4173983
// ==UserScript==
// @name chatwork to all helper
// @match https://www.chatwork.com/*
// @version 1.2
// ==/UserScript==
(function() {
document.getElementById('_chatText').addEventListener('blur', function(e){
if (/[@@]{2}/.test(e.target.value)) {
var to_list = [];