Skip to content

Instantly share code, notes, and snippets.

Avatar

Zeno Rocha zenorocha

View GitHub Profile
View showFirstCellInGoogleSheetAsiOSWidget.js
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/1RKJ65dTptKlXQ4E6JbGEVLrK6lC9pZnEvkzn68twckA/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
View git-clone.zsh
clone() {
git clone git@github.com:$1/$2.git
}
@zenorocha
zenorocha / etc-hosts-on-win.md
Last active February 17, 2023 12:13
/etc/hosts on Windows
View etc-hosts-on-win.md

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad

@zenorocha
zenorocha / basic.md
Last active March 26, 2023 09:00
New Firebase Auth vs Old Firebase Auth
View basic.md
@zenorocha
zenorocha / query.sql
Last active April 8, 2018 02:01
Median Page Weight ~ BigQuery
View query.sql
SELECT
NTH(50, quantiles(INTEGER(bytesHtml/1024)))
+ NTH(50, quantiles(INTEGER(bytesHtmlDoc/1024)))
as html,
NTH(50, quantiles(INTEGER(bytesCSS/1024)))
as css,
NTH(50, quantiles(INTEGER(bytesJS/1024)))
@zenorocha
zenorocha / interview.md
Last active April 8, 2018 02:01
Interview for "The Open Sourcer"
View interview.md
You've written in the past about the importance of talks for open source projects' adoption. How would you recommend a developer new to the community approach this?

Back in 2011, I was working with ActionScript but what I really wanted to do was HTML5. My father always said that if I wanted to learn something for real, I'd have to teach it. So I sent a proposal to speak about HTML5 at a free software forum in a very small city.

I didn't expect them to accept it but they did. I had no experience with HTML5 and had to give an entire presentation about it. I could have freaked out and give them some lame excuse for not to do it, but I put myself together and studied like crazy. Couple weeks later I gave the talk and survived to tell this story.

You see, most people think they should be experts in order to give a talk. That is just not true. Once you realize that every human being is different and we all have the capacity to teach something to someone else, you'll understand that you can do anything.

F

View launchpad-docs-search.js
var searchInput = document.querySelector('#search-input');
searchInput.addEventListener('input', function() { // Triggers when a user writes something
Launchpad // Uses Launchpad API Client to make an AJAX request
.url('http://liferay.io/docs/search/all') // Points to the API URL where the data is stored
.search('*', 'prefix', searchInput.value) // Filters results based on what the user typed
.highlight('content') // Automatically highlights the words that matched our query
.get() // Specifies what kind of HTTP request are we going to make
.then(function(result) {
// Renders the result in the page
View self-signed.zsh
#!/usr/bin/env zsh
openssl genrsa -des3 -out self-signed.pass.key 2048
openssl rsa -in self-signed.pass.key -out self-signed.key
openssl req -new -key self-signed.key -out self-signed.csr
openssl x509 -req -days 365 -in self-signed.csr -signkey self-signed.key -out self-signed.crt
echo "SHA1 fingerprint:\n"
openssl x509 -in self-signed.crt -sha1 -noout -fingerprint
@zenorocha
zenorocha / entry.js
Last active July 20, 2018 06:56
Bundling Clipboard.js distribution with Webpack
View entry.js
var Clipboard = require('clipboard');
@zenorocha
zenorocha / entry.js
Last active April 8, 2018 02:01
Bundling Clipboard.js' distribution with Webpack
View entry.js
var Clipboard = require('clipboard');