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
# this one will not work, it creates a syntax error | |
class ArticlesController < ApplicationController | |
def new | |
end | |
def create | |
render plain: params[:article].inspect | |
end | |
end |
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
p() { | |
if [[ $1 ]]; then | |
ps aux | grep -i $1 | |
else | |
ps aux | less | |
fi | |
} | |
alias cpu='top -o cpu -s 8 -n 11' |
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
countdown() { | |
[[ -z $1 ]] && seconds=60 || seconds=$1 | |
since=$(date +%s) | |
remaining=$seconds | |
while (( remaining >= 0 )) | |
do | |
printf "\r%-10d" $remaining | |
sleep 0.5 | |
remaining=$(( seconds - $(date +%s) + since )) | |
done |
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
// This will match an email given any string | |
// note even my ' in the string was fine ;D | |
var re = /[\w]+@[\w-]+\.[\w]+/g; | |
var str2 = "my email is not [email protected] it's actually [email protected]"; | |
var myArray = str2.match(re); | |
myArray | |
//search inside just a target <tag> in DevTools console using RegEx |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Tabbed Form</title> | |
<style type="text/css"> | |
/*-----------------CSS-------------------*/ | |
body { | |
width: 500px; | |
margin: auto; |
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
Verifying that +un5t0ppab13 is my openname (Bitcoin username). https://onename.io/un5t0ppab13 |
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
# Simple calculator | |
function calc() { | |
local result=""; | |
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')"; | |
# └─ default (when `--mathlib` is used) is 20 | |
# | |
if [[ "$result" == *.* ]]; then | |
# improve the output for decimal numbers | |
printf "$result" | |
NewerOlder