Skip to content

Instantly share code, notes, and snippets.

Rafael Nunes Verger rafaelverger

View GitHub Profile
@rafaelverger
rafaelverger / vwdependencies.sql
Created Aug 28, 2018 — forked from adamantnz/vwdependencies.sql
Redshift - view table/schema dependencies
View vwdependencies.sql
CREATE OR REPLACE VIEW dbo.vwdependencies
AS
SELECT DISTINCT c_p.oid AS tbloid
,n_p.nspname AS schemaname
,c_p.relname AS NAME
,n_c.nspname AS refbyschemaname
,c_c.relname AS refbyname
,c_c.oid AS viewoid
FROM pg_class c_p
JOIN pg_depend d_p ON c_p.relfilenode = d_p.refobjid
@rafaelverger
rafaelverger / integration.html
Last active Nov 14, 2017
Integrate DFP click macro and cache buster to Space AdManager
View integration.html
<script type="text/javascript">
var space = window.space || { runs: [] };
var ADID = 'YOUR_AD_ID'; var WIDTH = 1; var HEIGHT = 1;
space.runs.push(function () {
space
.ad(ADID)
.setSize(WIDTH, HEIGHT)
.setMacro('%%CLICK_URL_UNESC%%')
.setCacheBuster('%%CACHEBUSTER%%')
.fire();
@rafaelverger
rafaelverger / create_prebid_lis.py
Last active Nov 7, 2017
DFP - Create Prebid LineItems
View create_prebid_lis.py
from googleads import dfp
DFP_CLIENT = dfp.DfpClient.LoadFromStorage()
ORDER_SERVICE = DFP_CLIENT.GetService('OrderService', version='v201705')
LI_SERVICE = DFP_CLIENT.GetService('LineItemService', version='v201705')
CTGT_SERVICE = DFP_CLIENT.GetService('CustomTargetingService', version='v201705')
LICA_SERVICE = DFP_CLIENT.GetService('LineItemCreativeAssociationService', version='v201705')
PREBID_CREATIVE_IDS = [1234567890, 9087654321, 1357924680, 2468013579, 1234509876]
@rafaelverger
rafaelverger / cheerio_VS_jsdom_VS_html-truncate.js
Last active Apr 15, 2019
Truncate HTML: cheerio X jsdom X html-truncate
View cheerio_VS_jsdom_VS_html-truncate.js
const jsdom = require('jsdom');
const cheerio = require('cheerio');
const htmlTruncate = require('html-truncate');
const limit = 500;
const text = "<p>O ex-presidente Luiz Inácio Lula da Silva defendeu que o direito de protestar não deve afetar o direito de assistir aos jogos da Copa. \"Quem quiser fazer passeata que faça, quem quer levantar faixa que levante, faça o que quiser. O importante é que as pessoas saibam que da mesma forma que alguém tem o direito de dizer que não quer Copa, o cidadão que comprou ingresso e quer ir ver a Copa tem que ter a liberdade de ver a Copa\" , afirmou em entrevista à revista Carta Capital. \"O meu direito de protestar não impede o meu direito de ir ao estádio e ver um jogo de futebol e ir tranquilo e em paz.\"</p> <p>Lula também defendeu os investimentos do governo com o Mundial. \"O governo federal tomou uma atitude exemplar. Decidimos que o Estado iria fazer um financiamento de R$ 400 milhões pelo BNDES para o governador do Estado e para as empresas que quisessem fazer es
@rafaelverger
rafaelverger / takess.js
Last active Jun 9, 2018
Taking screenshot of full document body using html2canvas and uploading to cloudinary
View takess.js
function takeSS(cloudinary_name, cloudinary_key, cloudinary_unsigned_preset, main_element){
main_element = main_element || document.body;
var _takeSS = function(){
console.log('generating canvas...');
html2canvas(main_element, {
onrendered: function(canvas) {
var imageData = canvas.toDataURL();
// exposing image base64 to window context
window._lastCanvasImage = imageData;
console.log('uploading image (%d kb)...', imageData.length/1024);
@rafaelverger
rafaelverger / all-user-agents.js
Created Oct 1, 2014
Historical list of more than 9k user-agents
View all-user-agents.js
all_user_agents = [
'Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko)',
'Mozilla/5.0 (compatible; ABrowse 0.4; Syllable)',
'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser 1.98.744; .NET CLR 3.5.30729)',
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Maxthon; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)',
'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; GTB5;',
'Mozilla/4.0 (compatible; Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6; Acoo Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727); Windows NT 5.1; Trident/4.0; Maxthon; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2)',
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser; GTB6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)',
'Mozilla/4.0 (compatible; MSIE
@rafaelverger
rafaelverger / git-global-pull.sh
Last active Aug 29, 2015
Update all git projects from workspace
View git-global-pull.sh
#!/bin/bash
PWD=$(pwd)
GIT_ROOT="~/git-projects"
CYAN='\033[36m'
GREEN='\033[32m'
NC='\033[0m' # No Color
cd $GIT_ROOT > /dev/null
@rafaelverger
rafaelverger / load-umrum-min.js
Last active Aug 29, 2015
How to load UMRUM client script
View load-umrum-min.js
!function(a,b,c,d){
b._mrm=b._mrm||{},
b._mrm.hostId=a,
d=c.createElement("script"),
d.async=1,
d.src="//umrum.io/dist/umrum-client.js",
c.body.appendChild(d);
}("UMRUM_KEY",window,document);
You can’t perform that action at this time.