Skip to content

Instantly share code, notes, and snippets.

Avatar

Sérgio Lopes sergiolopes

View GitHub Profile
@sergiolopes
sergiolopes / duracao.sh
Last active April 3, 2018 17:48
Retorna o tempo total em segundos de um arquivo do ScreenFlow
View duracao.sh
#!/bin/bash
# Retorna o tempo total em segundos de um arquivo do ScreenFlow
#
# Requisito: Dar permissão de acessibilidade pro Terminal ou outra App que vai executar
# (System Preferences > Security & Privacy > Privacy > Accessibility > Add Application)
file=$1
if [ "$file" = "" ] || [ ! -d "$file" ]; then
echo Passe o nome do arquivo pra detectar a duração
@sergiolopes
sergiolopes / nerdnews.sh
Created June 6, 2016 18:58
Extrai textos das noticias do nerdnews
View nerdnews.sh
#!/bin/bash
for PAGINA in {1..2}; do
curl -s -L https://jovemnerd.com.br/categoria/nerdnews/page/$PAGINA/ | sed -n 's/.*href="\(https:\/\/jovemnerd.com.br\/nerdnews\/[^"]*\).*/\1/p'
done | \
while read link; do
curl -s $link > /tmp/nerdtech.html
xmllint --html --xpath '//div[@class="title"]/h2/text()' /tmp/nerdtech.html 2> /dev/null
@sergiolopes
sergiolopes / lazyload-v2.js
Last active February 2, 2023 03:55
Lazy load de imagens beeem simples
View lazyload-v2.js
(function(){
// como vamos usar o throttle varias vezes (no scroll e no resize),
// encapsulei essa funcionalidade numa função
function throttle(fn) {
fn.jarodei = false;
return function(){
if (fn.jarodei) return;
fn.jarodei = true;
@sergiolopes
sergiolopes / nginx.conf
Created April 7, 2016 15:02
config de server static simples com gzip
View nginx.conf
server {
listen 3030;
root /Users/alura/performance-web/site;
gzip on;
gzip_types text/css application/javascript image/svg+xml;
}
@sergiolopes
sergiolopes / osx.sh
Created February 13, 2016 01:35
OSX configs
View osx.sh
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
defaults write com.apple.universalaccess reduceTransparency -bool true
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
defaults write com.apple.finder ShowStatusBar -bool true
defaults write com.apple.Finder AppleShowAllFiles -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
hash tmutil &> /dev/null && sudo tmutil disablelocal
@sergiolopes
sergiolopes / nginx.conf
Created December 30, 2015 16:42
Mini vimeo proxy
View nginx.conf
server {
listen 12000;
location / {
set $vimeo_host $arg_host;
resolver 8.8.8.8;
proxy_pass $vimeo_host;
proxy_buffering off;
}
}
@sergiolopes
sergiolopes / 4shared.js
Last active July 2, 2017 03:02
urls do google drive / scribd
View 4shared.js
javascript:void function(){
var txt = [].slice.call(document.querySelectorAll('.fname h1 a')).map(el => el.href).reduce((url,acc) => acc + '\r\n' + url);
var ta = document.createElement('textarea');
document.body.appendChild(ta);
ta.value = txt;
ta.select();
document.execCommand('copy');
}();
@sergiolopes
sergiolopes / gist:fe4fc275fca6b3115a02
Created November 6, 2015 20:36
weinre webkit angular fix
View gist:fe4fc275fca6b3115a02
<script>
function whackWebkitMatchesSelector() {
var oldMatches = Element.prototype.webkitMatchesSelector
function newMatches(selector) {
try {
return oldMatches.call(this, selector)
}
catch (err) {
return false
@sergiolopes
sergiolopes / boleto.js
Created October 30, 2015 13:24
Bookmarklet pra colar codigo de boleto no home banking do santander
View boleto.js
javascript:void(function(){
var boleto = prompt();
var partes = boleto.trim().split(/[^\d]+/);
var iframe = document.querySelector('[name="Principal"]').contentWindow.document.querySelector('[name="Corpo"]').contentWindow.document.querySelector('#iframePrinc').contentWindow;
var inputs = iframe.document.querySelectorAll('.lista input');
for (var i = 0; i < inputs.length; i++) {
inputs[i].value = partes[i];
@sergiolopes
sergiolopes / SassMeister-input.scss
Created August 5, 2015 14:17
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
h1 {
font-size: 1em;
@media (min-width: 600px) {
font-size: 2em;
}