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
class Student { | |
fullName: string; | |
constructor(public firstName: string, public middleInitial: string, public lastName: string) { | |
this.fullName = firstName + " " + middleInitial + " " + lastName; | |
} | |
} | |
interface Person { | |
firstName: string; | |
lastName: string; |
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
#https://stackoverflow.com/questions/4869154/how-to-detect-adblock-on-my-website | |
# ads.js | |
var canRunAds = true; | |
# site template after <body> | |
<script> | |
if( window.canRunAds === undefined ){ | |
// adblocker detected, show fallback |
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 | |
# | |
# Toggles cloudflare security_settings base on system load | |
# Only prints output when the setting is changed to a different one | |
# Needs "jq" installed | |
# | |
# e.g. essentially_off, low, medium, high, under_attack | |
USERNAME=$1 |
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 | |
ramDiskCreate () | |
{ | |
if [ ! -d /Volumes/RAMDisk/intellij-cache/ ]; then | |
diskutil erasevolume HFS+ 'RAMDisk' `hdiutil attach -nomount ram://1024288`; | |
else | |
echo RAMDisk already created; | |
fi; | |
mkdir -p /Volumes/RAMDisk/intellij-caches; |
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 | |
function treesize() { | |
du -k -d 1 $1 | sort -nr | awk ' | |
BEGIN { | |
split("KB,MB,GB,TB", Units, ","); | |
} | |
{ | |
u = 1; | |
while ($1 >= 1024) { |
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
# To install as alarm, add this to crontab (crontab -e) | |
#30 8 * * 1-5 /usr/bin/osascript /Users/elvis/Documents/wakeUpSpotify.scpt | |
set volume 3 | |
# morning playlist | |
open location "spotify:user:elvispm83:playlist:5D8fO5FikywbgjOOeICk2e" | |
delay 5 | |
tell application "Spotify" | |
set the sound volume to 20 |
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
/** | |
* Return a cryptocurrency value in USD using coinmarketcap API | |
* | |
* @param string currency e.g. BTC, ETH | |
* | |
* @return float value | |
*/ | |
function coinmarketcap(currency) | |
{ | |
var body = UrlFetchApp.fetch("https://api.coinmarketcap.com/v1/ticker/"); |
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
# gitcommit this message will be commited, with the branch name prepended | |
# e.g. (on branch feature01) | |
# > gitcommit this is the commit message | |
# > Committed with message "feature01 this is the commit message" | |
gitcommit() { | |
gm_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p'); | |
gm_commitMessage="${gm_branch} $@" | |
git commit -m "${gm_commitMessage}" | |
echo Committed with message \"$(git log -n1 --pretty=format:%s)\" | |
} |
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
# add STRING-XXXXXXX to FILE-YYYYYY | |
# if commented out, it gets re-added | |
exec { "[task name]": | |
command => '/bin/echo "STRING-XXXXXXX" >> FILE-YYYYYY', | |
unless => '/bin/grep -E "^STRING-XXXXXXX$" FILE-YYYYYY' | |
} |
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
$(document).ready(function() { | |
/* | |
* Attach a "onchange" listener to file upload elements for each form. | |
* Behaviour: | |
* If the selected file size invalid (bigger than the value from the <input name="MAX_FILE_SIZE" /> element): | |
* - disable submit button | |
* - append a message (class="errors") to the form. | |
* If the selected file size is valid: | |
* - enable the submit button | |
* - remove the error message previously added |