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
http://jsbin.com/cipaxex/edit?js,console | |
https://jsbin.com/sideniv/edit?js,console | |
https://jsbin.com/gasarod/edit?js,console |
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
let targetWord = ''; | |
let dashes = ''; | |
let dArray = []; | |
let failCount = 0; | |
const categories = { | |
clubs: ['Manchester United', 'Barcelona', 'Real Madrid', 'Bayern Munich', | |
'Manchester City', 'Arsenal', 'Chelsea', 'Liverpool', 'Juventus', 'Tottenham Hotspur', | |
'Borussia Dortmund', 'Atletico Madrid', 'Inter Milan', 'West Ham United', 'Roma', | |
'Napoli', 'Everton', 'Newcastle United'], |
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
else if (path === "invites/accept") { | |
if (!session.uid) { | |
response.write(sessionErrorMessage); | |
return response.end(); | |
} | |
let status = yield db.collection("groups_members").insert({uid: session.uid, groupID: data.groupID, timestamp: new Date()}); | |
if (!status.result.ok) { | |
response.write('{"status": 500, "message": "Oops! An error occurred while adding you to group. Please try again."}'); | |
return response.end(); | |
} |
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
sanitizePhoneNumber(phone, ext, errh) { | |
errh = errh || function() {}; | |
if(typeof phone !== "string" && !(phone instanceof String)) { | |
errh("Phone number should be a string, "+(typeof phone)+" passed."); | |
return false; | |
} | |
if (phone.charAt(0) === "+") phone = phone.substring(1); | |
if (isNaN(Number(phone))) { | |
errh ("Phone number contains non-numeric characters"); |
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
const http = require("http"); | |
const https = require("https"); | |
const AWS = require('aws-sdk'); | |
const formidable = require("formidable"); | |
const uuid = require("uuid"); | |
let server = http.createServer(launch); | |
let s3 = new AWS.S3({ | |
// s3 credentials | |
}); |
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
overwrite(id, obj) { | |
client.del(`${id}-creation`, () => { | |
client.HMSET(`${id}-creation`, obj) | |
}) | |
}, | |
update(id, obj) { | |
client.HMSET(`${id}-creation`, obj) | |
}, |
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
/* ************************************************************************** */ | |
/* */ | |
/* ::: :::::::: */ | |
/* sudoku.c :+: :+: :+: */ | |
/* +:+ +:+ +:+ */ | |
/* By: jiwok <[email protected]> +#+ +:+ +#+ */ | |
/* +#+#+#+#+#+ +#+ */ | |
/* Created: 2019/07/20 20:00:06 by jiwok #+# #+# */ | |
/* Updated: 2019/07/20 21:18:15 by jiwok ### ########.fr */ | |
/* */ |
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
const request = require('request-promise'); | |
const environment = "staging"; | |
const t_config = { | |
oauth: { | |
consumer_key: process.env.TWITTER_CONSUMER_KEY, | |
consumer_secret: process.env.TWITTER_CONSUMER_SECRET, | |
token: process.env.TWITTER_ACCESS_TOKEN, | |
token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET | |
} |
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 receiveMessage(id, text) | |
{ | |
let state = redis.get(id); | |
if (state === "expecting default selection") processDefaultSelection(id, text) | |
else if (state == "expecting location") processLocationResponse(id, text) | |
else if (state === "expecting quantity") processQuantityResponse(id, text) | |
else sendDefaultMessage(id); // first message from user or user is in no state | |
} |
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
async function digestMessage(message) { | |
const encoder = new TextEncoder(); | |
const data = encoder.encode(message); | |
const hash = await crypto.subtle.digest('SHA-256', data); | |
return hash; | |
} | |
function toHexString(byteArray) { | |
return Array.from(byteArray, function(byte) { | |
return ('0' + (byte & 0xFF).toString(16)).slice(-2); |
OlderNewer