Skip to content

Instantly share code, notes, and snippets.

View johnjullies's full-sized avatar

John Jullies Palma johnjullies

View GitHub Profile
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
# Installed in my Linux Mint Olivia
# native extension for the pg gem
sudo apt-get install libpq-dev
# mysql
sudo apt-get install libmysql-ruby libmysqlclient-dev
# Emptying recycle bin with sudo files
rm -rf ~/.local/share/Trash/*
@johnjullies
johnjullies / Javascript Time Since.js
Created August 9, 2015 13:47
The question is how to format a JavaScript Date as a string stating the time elapsed similar to the way you see times displayed on Stack Overflow. e.g. 1 minute ago 1 hour ago 1 day ago 1 month ago 1 year ago
function timeSince(date) {
var seconds = Math.floor((new Date() - date) / 1000);
var interval = Math.floor(seconds / 31536000);
if (interval > 1) {
return interval + " years";
}
interval = Math.floor(seconds / 2592000);
@johnjullies
johnjullies / msconvert.js
Last active August 29, 2015 14:27 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
function convertMS(ms) {
var y, mo, d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
mo = Math.floor(d / 30);
# Kafka:
# starting Zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties
# Kafka server
bin/kafka-server-start.sh config/server.properties
# create topic 'test'
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
<!-- Keybindings for window tiling -->
<keybind key="C-W-Up"> # FullScreen
<action name="Maximize"/>
</keybind>
<keybind key="C-W-Down"> # MiddleScreen
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>center</x><y>center</y><width>50%</width><height>50%</height></action>
</keybind>
@johnjullies
johnjullies / convert.sh
Created September 20, 2016 10:54 — forked from jamesflorentino/convert.sh
Makefile for creating favicons from 16x16 up to 128x128.
convert favicon.png -resize 16x16 favicon.ico;
convert favicon.png -resize 16x16 favicon_16x16.png;
convert favicon.png -resize 32x32 favicon_32x32.png;
convert favicon.png -resize 64x64 favicon_64x64.png;
convert favicon.png -resize 128x128 favicon_128x128.png;
echo "conversion complete";
ARRAY=("Narcos - 01x01 - Descenso"
"Narcos - 01x02 - The Sword of Simon Bolivar"
"Narcos - 01x03 - The Men of Always"
"Narcos - 01x04 - The Palace in Flames"
"Narcos - 01x05 - There Will Be a Future"
"Narcos - 01x06 - Explosivos"
"Narcos - 01x07 - You Will Cry Tears of Blood"
"Narcos - 01x08 - La Gran Mentira"
"Narcos - 01x09 - La Catedral"
"Narcos - 01x10 - Despegue"); j=0; for i in *.srt; do mv "$i" "${ARRAY[$j]}".srt; let j=j+1;done