Skip to content

Instantly share code, notes, and snippets.

View zirosas's full-sized avatar

Jiro Sasamoto zirosas

View GitHub Profile
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
});
function mysql_real_escape_string (str) {
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
switch (char) {
case "\0":
return "\\0";
case "\x08":
return "\\b";
case "\x09":
return "\\t";
case "\x1a":
@zirosas
zirosas / js Refresh page
Created March 10, 2014 22:48
Refresh page
window.setTimeout(function(){location.reload()},3000)
@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 / Reset AUTO_INCREMENT in MySQL
Created February 28, 2014 04:31
Reset AUTO_INCREMENT in MySQL
ALTER TABLE tablename AUTO_INCREMENT = 1
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);
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
$("#foo")
.clone() //clone the element
.children() //select all the children
.remove() //remove all the children
.end() //again go back to selected element
.text();
@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
@zirosas
zirosas / Ignoring versioned files
Last active January 3, 2016 12:39
Git lets you ignore those files by assuming they are unchanged.
This is done by running the git update-index --assume-unchanged path/to/file.txt command. Once marking a file as such, git will completely ignore any changes on that file; they will not show up when running git status or git diff, nor will they ever be committed.
To make git track the file again, simply run
git update-index --no-assume-unchanged path/to/file.txt.
https://help.github.com/articles/ignoring-files