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
HTMLElement.prototype.matchesSelector = function(selector) { | |
var clonedElem = this.cloneNode(); | |
var docFrag = new DocumentFragment(); | |
docFrag.appendChild(clonedElem); | |
return (docFrag.querySelectorAll(selector).length > 0); | |
}; | |
/* | |
document.body.matchesSelector("body") // true | |
*/ |
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
var gourdify = function(map){ | |
var keys = Object.keys(map); | |
var ps = document.querySelectorAll("p"); | |
[].slice.call(ps).forEach(function(p){ | |
keys.forEach(function(key){ | |
var regex = new RegExp(key + "\\w+", "gi"); | |
p.innerHTML = p.innerHTML.replace(regex, map[key]); | |
}); |
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
body { | |
font-family: "Segoe UI", "Noto Sans CJK TC", sans-serif; | |
padding-top: 70px; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
font-family: "Segoe UI", "Noto Sans CJK TC", sans-serif; | |
text-transform: uppercase; | |
letter-spacing: -0.03em; | |
} |
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 sys | |
from http.server import CGIHTTPRequestHandler, HTTPServer | |
port = 8000 | |
if len(sys.argv) > 1: | |
port = int(sys.argv[1]) | |
handler = CGIHTTPRequestHandler | |
handler.cgi_directories = ["/py"] | |
server = HTTPServer(("", port), handler) |
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
#!/bin/bash | |
black="\033[0;30m" | |
blue="\033[0;34m" | |
green="\033[0;32m" | |
cyan="\033[0;36m" | |
purple="\033[0;35m" | |
orange="\033[0;33m" | |
lightgrey="\033[0;37m" | |
darkgrey="\033[1;30m" |
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 sys | |
import webbrowser | |
from urllib.request import Request, urlopen | |
import urllib.parse | |
from bs4 import BeautifulSoup | |
os.system("clear") | |
try: |
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
print "Welcome" | |
name = raw_input("Tell me your name, child\n") | |
word = raw_input("Enter a random word pl0x\n") | |
if len(word) > 0 and word.isalpha(): | |
print "You said '%(word)s', %(name)s" % {"word": word, "name": name} | |
else: | |
print "ur an fgt" |
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
var yasify = function(string) { | |
return string.replace(new RegExp("e", "gi"), "a"); | |
}; | |
// yasify("yes") --> "yas" | |
// yasify("yeya") --> "yaya" | |
// yasify("doge very wow") --> "doga vary wow" |
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
<section id="introduction"> | |
<h2>Introduction</h2> | |
<p>We, the Sha Tin College Student Council, are a group consisting of 16 students who are all dedicated to the objective of fostering a unified, harmonious, and equal community.</p> | |
<p>We are responsible for expressing student voice in the Sha Tin campus by working cohesively with all parties to achieve and implement the goals desired by the student community.</p> | |
<p>As representatives of the student population, we take any and all opinions in the highest regard with the aim of creating a holistic environment for all.</p> | |
<img src="img/group-photo.jpg"> | |
</section> |
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
<body> | |
<section data-id="introduction"> | |
</section> | |
<section data-id="members"> | |
</section> | |
<section data-id="news"> |