This file contains hidden or 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 Game = function (return_function) | |
| { | |
| this.play = function (bet, callback) | |
| { | |
| var return_amount = return_function(bet) | |
| if (callback !== undefined) | |
| { | |
| callback(return_sum); | |
| } |
This file contains hidden or 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 express = require("express"); | |
| let server = express() | |
| let bodyParser = require('body-parser'); | |
| let multer = require('multer'); // v1.0.5 | |
| let upload = multer(); // for parsing multipart/form-data | |
| // $npm install express body-parser multer --save |
This file contains hidden or 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 socket = io(); | |
| socket.on("message", function (msg) | |
| { | |
| $("#messages").append($("<li>").text(msg)); | |
| }); |
This file contains hidden or 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
| // Original implementation using Object.values | |
| var cols = Object.values(this.data); | |
| for (var i = 0; i < cols.length; i++) | |
| { | |
| console.log(Object.values(this.data[i])); | |
| new this.Row(Object.values(this.data[i])); | |
| } | |
| // Newer implementation using Object.entries | |
| for (var i = 0; i < Object.entries(this.data).length; i++) |
This file contains hidden or 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
| "use strict"; | |
| function explode_array(array) | |
| { | |
| let items = {}; | |
| } | |
| let data = [{"A": 1, "B": 2}, {"A": 2, "B": 3}]; | |
| console.log(explode_array(data)); |
This file contains hidden or 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
| #! /usr/bin/env python | |
| import socket | |
| from msvcrt import getch | |
| def get_key(): | |
| return ord(getch()) | |
| def main(): | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
This file contains hidden or 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 characters = "0123456789abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/" | |
| function encode64(num) | |
| { | |
| let BASE = 64; //Define the base to convert num to | |
| let string = ""; | |
| let i = 0; | |
| let cont = true; |
This file contains hidden or 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* range(start, stop, step = 1) | |
| { | |
| if (stop <= start & step > 0 | stop >= start & step < 0) | |
| { | |
| throw "Stop value is out of range"; | |
| } | |
| else if (start >= stop & step > 0 | start <= stop & step < 0) | |
| { | |
| throw "Start value is out of range"; | |
| } |
This file contains hidden or 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
| class json | |
| { | |
| static encode(object) | |
| { | |
| return JSON.stringify(object); | |
| } | |
| static decode(string) | |
| { | |
| console.log(string); |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>unicode</title> | |
| <script type="text/javascript"> | |
| function 😇(🍓, 🍘) | |
| { | |
| if (🍓 == "ä" and 🍘 != "🍕") | |
| { |