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
/* | |
Bubble sort *hurr* | |
*/ | |
function bubbleSort(list) { | |
let swapped; | |
do { | |
swapped = false; | |
for (let i = 0; i list.length; i++) { | |
if (list[i] > list[i+1]) { |
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 | |
# Usage: | |
# | |
# p <projectname> | |
# e.g. | |
# p website | |
# | |
# Will open up a tmux session with VIM started in the main | |
# window, and two smaller windows (process & linting) at the bottom |
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
# From : http://stackoverflow.com/questions/4023830/bash-how-compare-two-strings-in-version-format | |
#!/bin/bash | |
vercomp () { | |
if [[ $1 == $2 ]] | |
then | |
return 0 | |
fi | |
local IFS=. | |
local i ver1=($1) ver2=($2) |
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
#---------------------------------------- | |
# Navigation aliases | |
#---------------------------------------- | |
alias please="sudo" | |
alias ..="cd .." | |
alias 2="cd ..\.." | |
alias 3="cd ..\..\.." | |
alias 4="cd ..\..\..\.." | |
alias x="pushd" | |
alias xx="popd" |
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
/** | |
* EventBus is a simple pub/sub system for an application | |
* written for demonstration purposes. | |
* When using NodeJs you should use the 'event' module. | |
*/ | |
var EventBus = { | |
topics: {}, | |
subscribe: function(topic, listener){ | |
if (!this.topics[topic]) { this.topics[topic] = []; } |
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
function uploadImage { | |
curl -s -F "image=@$1" -F "key=486690f872c678126a2c09a9e196ce1b" https://imgur.com/api/upload.xml | grep -E -o "<original_image>(.)*</original_image>" | grep -E -o "http://i.imgur.com/[^<]*" | |
} | |
scrot -s "shot.png" | |
uploadImage "shot.png" | xclip -selection c | |
rm "shot.png" | |
notify-send "Done uploading to imgur!" |
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 | |
# Requires : scrot, imagemagick, i3lock | |
# Creates a screenshot of the current desktop, | |
# blurs it, then sets it as the "lock" image | |
# for i3lock. Looks pretty slick! | |
scrot /tmp/tempshot.png | |
convert /tmp/tempshot.png -blur 0x5 /tmp/screenshot.png | |
i3lock -i /tmp/screenshot.png |
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
# Kapott's i3wm configuration | |
# | |
# I don't like non-tiled window managers, and i3 is easy to configure, | |
# and not as hardcore keyboard-purist like e.g. ratpoison. | |
# | |
# Programs I combine with this; | |
# | |
# scrot screenshots | |
# imagemagick fast image-processing withing bash scripts | |
# i3lock locking my screen |
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
/** | |
* From SO thread : | |
* http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript | |
*/ | |
function getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); |
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
[user] | |
name = | |
email = | |
[push] | |
default = current | |
[core] | |
editor = vim | |
[alias] | |
c = commit | |
co = checkout |
NewerOlder