Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Unique page title - My Site</title>
<script type="module">
document.documentElement.classList.remove('no-js');
<!DOCTYPE html>
<head>
<meta property="og:title" content="Dog - Wikipedia">
<meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Collage_of_Nine_Dogs.jpg/1200px-Collage_of_Nine_Dogs.jpg">
</head>
<body>
<p>Minimal set of tags to render a card: og:title + og:image</p>
</body>
</html>
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@vjo
vjo / userid.sh
Last active August 19, 2016 18:53
Get Twitter user id from command line using twurl and jq
#!/bin/bash
if [ $# -eq 0 ] || [ $1 == "-h" ] || [ $1 == "--help" ]; then
echo 'Usage: userid <comma,separated,handles>'
echo 'Options:'
echo '-h, --help Show help'
exit 0
fi
twurl --request 'GET' '/1.1/users/lookup.json?screen_name='$1 | jq '.[] | {user_id: .id, screen_name: .screen_name}'
@vjo
vjo / gist:4abd611551ca79a08be271e486b2d33f
Last active May 14, 2016 22:02
Set node version using nvm
nvm install v4.4
nvm alias lts v4.4
nvm install v6.1
nvm alias stable v6.1
nvm alias default stable
nvm use lts or nvm use stable
@vjo
vjo / install_code.sh
Last active February 17, 2016 10:57
Install software and code sample on macs for a coding course.
#!/bin/sh
echo "Move on Desktop";
cd ~/Desktop;
echo "Install Brew";
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)";
echo "Install Brew Cask";
brew install cask;
@vjo
vjo / read-json.py
Created December 24, 2015 00:49
Read JSON files in Python
import json
config = json.loads(open('config.json').read())
@vjo
vjo / flower.txt
Created December 8, 2015 18:29
Flower one of your colleague super quickly
https://mail.google.com/mail/?view=cm&fs=1&to=MAIL.LIST@DOMA.IN&su=I+like+flowers&body=Hello,%0a%0aGoing+to+a+Natural+Park+for+has+been+a+revelation+for+me.+I+really+like+flowers.+I+am+curious+to+know+more+about+flowers+and+nature.%0aSo,+please+feel+free+to+contact+me+to+discuss+about+how+we+can+put+more+flowers+in+the+office.%0a%0aCheers,%0a%0aP.S+:+My+favourite+color+is+red+so+I+am+a+huge+fan+of+red+flowers.+If+you+have+any+questions+about+red+flowers,+I+probably+can+help.
@vjo
vjo / Converting-date.md
Last active August 29, 2015 14:26
Issue Date in R

I'm parsing a file, converting the date in a Date type and adding 2 columns based on the date.

  data <- read.csv(csvFile, na.strings = "")

  ## Convert date column as Date type
  data[["date"]] <- as.POSIXct(data[["date"]])
  
  ## Add a time and day column
  data[["time"]] <- strftime(data[["date"]], format="%H:%M")
@vjo
vjo / .vimrc
Last active August 29, 2015 14:16
Vim - Stripping whitespace
" This will work:
autocmd BufWritePre *.js,*.py :%s/\s\+$//e
" This works too:
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc