Skip to content

Instantly share code, notes, and snippets.

View bazuzu931's full-sized avatar
💭
you're tearing me apart lisa!

bazuzu931 bazuzu931

💭
you're tearing me apart lisa!
View GitHub Profile
@bazuzu931
bazuzu931 / index_mini.html
Last active February 10, 2017 14:30
index_mini.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="main.css">
</head>
<body>
<script src=" "></script>
</body>
@bazuzu931
bazuzu931 / var_dump_in_console.js
Last active February 10, 2017 14:31
var_dump_in_console.js
function console_log( $data ){
echo '<script>';
echo 'console.log('. json_encode( $data ) .')';
echo '</script>';
}
@bazuzu931
bazuzu931 / article_layout.html
Last active February 10, 2017 14:35
article_layout.html
<article class="main-article">
<figure>
<img src="" alt="">
<figcaption></figcaption>
</figure>
<header>
<h1>Title</h1>
<h4>Short info</h4>
@bazuzu931
bazuzu931 / NodeList_sorting.js
Last active February 10, 2017 14:34
NodeList_sorting.js
const nodeList = document.getElementsByClassName('div');
[].forEach.call(nodeList, function(element) {
console.log(element); // get list of array with classes
};
@bazuzu931
bazuzu931 / tkinter_Win_button.py
Last active February 10, 2017 14:34
tkinter_Win_button.py
import tkinter
from tkinter import ttk
root = tkinter.Tk()
button = ttk.Button(root, text="hello")
button.pack()
root.mainloop()
@bazuzu931
bazuzu931 / download_big_file_by_chunks.py
Last active February 10, 2017 14:33
download_big_file_by_chunks.py
import requests
def download(url):
file = url.split('/')[-1]
if file.split('.')[-1] != "mp3":
file += ".mp3"
r = requests.get(url, stream=True)
with open(file, 'wb') as f:
@bazuzu931
bazuzu931 / download_file(media,txt).py
Last active February 14, 2017 17:44
download_file(media,txt).py
import requests
def file_down(url):
r = requests.get(url, stream=True)
if r.status_code == requests.codes.ok: # requests.codes.ok == 200
with open("music.mp3", 'wb') as f:
f.write(r.content)
file_down("the_link_must_be_in_mp3_format.mp3") # example
@bazuzu931
bazuzu931 / correct_array_sort.js
Last active February 10, 2017 14:28
correct_array_sort.js
[1,2,5,10].sort((a, b) => a- b)
@bazuzu931
bazuzu931 / main_loop_pygame.py
Last active February 10, 2017 14:27
main_loop_pygame.py
running = True
while running:
for e in pygame.event.get():
if e.type == QUIT:
running = False