Skip to content

Instantly share code, notes, and snippets.

View zirosas's full-sized avatar

Jiro Sasamoto zirosas

View GitHub Profile
@zirosas
zirosas / 0_reuse_code.js
Created February 2, 2014 20:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
$("#foo")
.clone() //clone the element
.children() //select all the children
.remove() //remove all the children
.end() //again go back to selected element
.text();
U: Working file was updated
G: Changes on the repo were automatically merged into the working copy
M: Working copy is modified
C: This file conflicts with the version in the repo
?: This file is not under version control
var txt = $('.writer').text();
var timeOut;
var txtLen = txt.length;
var char = 0;
$('.writer').text('|');
(function typeIt() {
var humanize = Math.round(Math.random() * (200 - 30)) + 30;
timeOut = setTimeout(function() {
char++;
var type = txt.substring(0, char);
@zirosas
zirosas / Reset AUTO_INCREMENT in MySQL
Created February 28, 2014 04:31
Reset AUTO_INCREMENT in MySQL
ALTER TABLE tablename AUTO_INCREMENT = 1
@zirosas
zirosas / Skype
Created March 2, 2014 09:51
How can I run two Skype accounts on a Mac?
First, this assumes you already launched Skype normally from the Application icon, and logged into the first Skype account. One method is to open a Terminal (console) window, change directories to the Skype application, then simply run a second instance using the sudo command:
Step 1: Open a Terminal window
Step 2: cd /Applications/Skype.app/Contents/MacOS/
Step 3: sudo ./Skype
Now the second instance of Skype will launch, you will see trailing output in the console window.
Note: Do not close the window or it will force Skype to close. You may minimize the window if it's in the way.
@zirosas
zirosas / js Refresh page
Created March 10, 2014 22:48
Refresh page
window.setTimeout(function(){location.reload()},3000)
app.all('/', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
next();
});
app.get('/', function(req, res, next) {
// Handle the get for this route
});
$( document.body ).on( 'click', '.dropdown-menu li', function( event ) {
var $target = $( event.currentTarget );
$target.closest( '.btn-group' )
.find( '[data-bind="label"]' ).text( $target.text() )
.end()
.children( '.dropdown-toggle' ).dropdown( 'toggle' );
return false;
@zirosas
zirosas / new_gist_file.py
Created April 4, 2014 06:33
From http://tacamy.hatenablog.com/entry/2013/05/03/050329 ブラウザのアドレスバーに http://localhost:8888/{ファイル名} と入力して表示確認
$ python -m SimpleHTTPServer 8888