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
import os | |
import random, json, time, datetime | |
from flask import Flask, session, render_template, url_for, request, redirect, jsonify, Response | |
from flask_session import Session | |
from flask_socketio import SocketIO, emit, join_room, leave_room | |
import random, json, time, datetime | |
app = Flask(__name__) |
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
@app.route("/") | |
def index(): | |
return render_template("index.html") |
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
{% extends "layout.html" %} | |
{% block title %} | |
Hello ! | |
{% endblock %} | |
{% block head %} | |
{% endblock %} | |
{% block body %} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
{% block javascripts %} {% endblock %} | |
<title> | |
{% block title %}{% endblock %} | |
</title> | |
</head> |
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
make() { | |
if [ $1 = "run" ]; then | |
g++ -Wall -o "$2" "$2".cpp | |
./"$2" | |
printf "\n" | |
else | |
g++ -Wall -o "$1" "$1".cpp | |
printf "Success! \n" | |
fi | |
} |
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 increase() { | |
// increment each time | |
this.x++; | |
} | |
// Create a property to the function object | |
increase.x = 0; | |
// Call function few times | |
increase(); |
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 increase() { | |
// increment each time | |
this.x++; | |
} | |
// Create a property to the function object | |
increase.x = 0; | |
// Call function few times with using itself as `this` | |
increase.call(increase); |
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 foo() { | |
var a = 2; | |
// This magically executes the bar() function | |
// we will explain this later in the article | |
this.bar(); | |
} | |
function bar() { | |
console.log(this.a); |
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 doSomething() { | |
// "use strict"; // uncomment to run in strict mode | |
console.log( this.x ) | |
} | |
var x = "Hello World!"; | |
// Here the call-site of the function is global scope | |
doSomething(); // "Hello World!" |
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 doSomething() { | |
console.log( this.x ); | |
} | |
// This is the context object | |
var obj = { | |
x: "Hello World!", | |
y: doSomething | |
} |
OlderNewer