Skip to content

Instantly share code, notes, and snippets.

View yhay81's full-sized avatar

Yusuke Hayashi yhay81

View GitHub Profile

5 Steps to know about JavaScript Closure

This is what I think is easy way to understand what closure of JavaScript is.

Step 1. Declaration variables

When we use variables in programming, at first we declare it and then use it. So, what happens when I declare the variable which name is already declared?

@yhay81
yhay81 / goldbach-comet.py
Last active May 4, 2019 00:50
Goldbach's comet follows x^(0.8) ?
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from sympy import sieve
def prime_doubles(upper):
result = [0] * (2 * upper + 1)
sieve.extend(upper)
max_prime_index, _ = sieve.search(upper)
for i in range(1, max_prime_index+1):
@yhay81
yhay81 / pin-bot.py
Last active April 12, 2022 11:32
Discord bot who can pin messages with just adding reaction 📌
import discord
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
@yhay81
yhay81 / memo-bot.py
Last active February 17, 2018 08:45
Discord bot which remember and call your memo anywhere.
import sqlite3
import discord
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)