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
var fs = require('fs'); | |
var readline = require('readline'); | |
var google = require('googleapis'); | |
var googleAuth = require('google-auth-library'); | |
var SCOPES = ['https://mail.google.com/']; | |
var TOKEN_PATH = 'gmail-api-token.json'; | |
// Load client secrets from a local file. |
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 initialUserData(){ | |
$.ajax({ | |
url: 'https://randomuser.me/api/?results=10', | |
dataType: 'json', | |
success: function(data){ | |
console.log('get ajax data success',data); | |
window.data = data.results; | |
initialReact(); | |
} | |
}); |
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
/** | |
* game url : http://zzzscore.com/1to50/en/ | |
* paste code in console , and happy to hack | |
*/ | |
var Hacker = function () { | |
var self = this; | |
self.now_click_number = 1; | |
function getNextBox() { | |
if (self.now_click_number > 50) { |
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
var express = require('express'); | |
var app = express(); | |
function showMessage(req,res){ | |
console.log("server has send message"); | |
res.send('Hello World!'); | |
} | |
function checkSession(req,res,next){ |
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
#include <IRremote.h> | |
#include <Wire.h> | |
#include <Sodaq_DS3231.h> | |
#include <LiquidCrystal_I2C.h> | |
int RECV_PIN = 2; | |
IRrecv irrecv(RECV_PIN); | |
decode_results results; |
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
var output = TestUtils.renderIntoDocument(<Test value="123" />); | |
// rerender by React.render | |
React.render(<Test value="456" />, React.findDOMNode(output).parentNode); |
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
sudo apt-get update | |
sudo apt-get install g++ -y | |
sudo apt-get install build-essential -y | |
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 |
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
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', url, true); | |
xhr.responseType = 'arraybuffer'; | |
xhr.onload = function () { | |
if (this.status === 200) { | |
var filename = ""; | |
var disposition = xhr.getResponseHeader('Content-Disposition'); | |
if (disposition && disposition.indexOf('attachment') !== -1) { | |
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; | |
var matches = filenameRegex.exec(disposition); |
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
echo 'kill all running container' | |
docker kill $(docker ps -q) | |
echo 'remove all container' | |
docker rm -v $(docker ps -a -q) | |
echo 'remove all volumes' | |
docker volume rm $(docker volume ls -q) | |
echo 'Delete all untagged/dangling (<none>) images' | |
docker rmi $(docker images -q -f dangling=true) |
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
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561 | |
/* | |
* How to delete items from an Array in JavaScript, an exhaustive guide | |
*/ | |
// DON'T use the delete operator, it leaves a hole in the array: | |
var arr = [4, 5, 6]; | |
delete arr[1]; // arr now: [4, undefined, 6] |
OlderNewer