- A Pen is worth a thousand docs.
- Be the developer your linter thinks you are.
- How do you comfort a JavaScript bug? You console it!
- How would you React if I said I love Vue?
- If a groundhog inspects their Web Component, do they see their Shadow DOM?
- If you get tired, be like an AJAX request and REST.
- If you want to
flex
your skills and go off thegrid
, try coding a layout withfloat
. - Keep friends close and formatters closer.
- Keep the
<main>
thing the<main>
thing. - Knock knock! Race condition. Who's there?
Instantly share code, notes, and snippets.
HatScripts HatScripts
🎩
Programmer, graphic designer & web developer.
- Melbourne, Australia
-
20:02
(UTC +11:00) - https://codepen.io/HatScripts
HatScripts
/ run_as_admin.py
Last active
September 18, 2020 15:41
— forked from GaryLee/RunAsAdmin.py
Elevate the privilege to admin. Support both python script and pyinstaller wrapped program. Need ctypes only.
This file contains hidden or 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
# Based on Gary Lee's code:
# https://gist.github.com/GaryLee/d1cf2089c3a515691919
# https://stackoverflow.com/a/33856172/2203482
def run_as_admin(argv=None):
import ctypes
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
import sys
HatScripts
/ codepen_jokes.md
Last active
October 18, 2025 06:16
Programming jokes/one-liners found on CodePen
This file contains hidden or 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
// Find first value matching a condition
arr.find(e => someCondition(e))
// e.g.
[12, 5, 8, 130, 44].find(i => i > 100) // 130
[7, 3, 9, 5, 6, 1].find(i => i % 2 == 0) // 6
// Remove FIRST occurrence of value from array
let index = arr.indexOf(value)
if (index > -1) {
arr.splice(index, 1)
HatScripts
/ webkit.css
Last active
October 17, 2018 10:57
This file contains hidden or 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
*{
box-shadow: none !important;
transition: none !important;
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
}
@media /* Large screen, non-retina */
only screen and (min-width: 1000px) {
HatScripts
/ video-thumbnails-generator.sh
Created
August 24, 2018 05:26
— forked from shunchu/video-thumbnails-generator.sh
Batch generate thumbnails from mp4 files using ffmpg
This file contains hidden or 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
# setup
FILES=name_of_file_to_match_*.mp4
SEEK_POINT=00:00:30
IMG_FORMAT=png
FRAME_SIZE=150X100
DEST=thumbnails
for f in $FILES
HatScripts
/ play.svg
Created
April 7, 2018 10:10
HatScripts
/ sass-functions.md
Last active
April 3, 2019 14:23
— forked from AllThingsSmitty/sass-functions.md
Sass Functions Cheat Sheet
HatScripts
/ examples.py_console.txt
Created
April 28, 2017 05:41
This file contains hidden or 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
Running: with_example
80% (8 of 10) |##################### | Elapsed Time: 0:00:00 ETA: 0:00:00
Running: with_example_stdout_redirection
100% (10 of 10) |#########################| Elapsed Time: 0:00:01 Time: 0:00:01
70% (7 of 10) |################## | Elapsed Time: 0:00:00 ETA: 0:00:00 80% (8 of 10) |##################### | Elapsed Time: 0:00:00 ETA: 0:00:00 90% (9 of 10) |######################## | Elapsed Time: 0:00:00 ETA: 0:00:00
100% (10 of 10) |#########################| Elapsed Time: 0:00:01 Time: 0:00:01
Running: basic_widget_example
100%|#########################################################################|
Test: N/A% |/ | ETA: --:--:-- 0.0 s/BTest: 100% || | Time: 0:00:00 1.9 MiB/s
1.7 MiB/s <<<|########################################|>>> 100% Time: 0:00:00
HatScripts
/ AOL.svg
Created
April 23, 2017 03:30
HatScripts
/ xdiff_string_diff.js
Created
April 12, 2017 14:04
xdiff_string_diff function from http://locutus.io/php/xdiff/xdiff_string_diff/
This file contains hidden or 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 xdiff_string_diff(oldData, newData, contextLines) {
// discuss at: http://locutus.io/php/xdiff_string_diff
// original by: Brett Zamir (http://brett-zamir.me)
// based on: Imgen Tata (http://www.myipdf.com/)
// bugfixed by: Imgen Tata (http://www.myipdf.com/)
// improved by: Brett Zamir (http://brett-zamir.me)
// note 1: The minimal argument is not currently supported
// example 1: xdiff_string_diff('', 'Hello world!')
// returns 1: '@@ -0,0 +1,1 @@\n+Hello world!'
// (This code was done by Imgen Tata; I have only reformatted for use in Locutus)