Skip to content

Instantly share code, notes, and snippets.

View rahgurung's full-sized avatar
💻
Working

Rahul Gurung rahgurung

💻
Working
View GitHub Profile
@rahgurung
rahgurung / application.py
Created October 26, 2018 16:01
file for blog post
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__)
@rahgurung
rahgurung / layout.html
Created October 26, 2018 16:09
blogpost 4
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% block javascripts %} {% endblock %}
<title>
{% block title %}{% endblock %}
</title>
</head>
@rahgurung
rahgurung / application.py
Last active October 26, 2018 16:15
blog post file - 2
@app.route("/")
def index():
return render_template("index.html")
@rahgurung
rahgurung / index.html
Created October 26, 2018 16:07
blog post 3
{% extends "layout.html" %}
{% block title %}
Hello !
{% endblock %}
{% block head %}
{% endblock %}
{% block body %}
@rahgurung
rahgurung / cpp.bash
Created November 9, 2019 13:40
script for c/c++ environment
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
}
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);
function doSomething() {
console.log( this.x );
}
// This is the context object
var obj = {
x: "Hello World!",
y: doSomething
}
function doSomething(a) {
this.x = "Hello";
this.y = "World!";
}
var bar = new doSomething();
// `this` has been bound to bar here
console.log(bar.x); // Hello
console.log(bar.y); // World!
function increase() {
// increment each time
this.x++;
}
// Create a property to the function object
increase.x = 0;
// Call function few times
increase();
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);