Skip to content

Instantly share code, notes, and snippets.

View virgilio's full-sized avatar

Virgílio N Santos virgilio

  • Matchbox Ideas
  • Campinas-SP, Brazil
View GitHub Profile
@virgilio
virgilio / App.js
Created November 16, 2019 17:54
PoC using Youtube Player API with react-youtube to control a player
import React from 'react';
import YouTube from 'react-youtube';
import './App.css';
function App() {
const opts = {
playerVars: { }
// https://developers.google.com/youtube/player_parameters
}
# -*- coding: utf-8 -*-
import csv, json, codecs, sys
from HTMLParser import HTMLParser as html
import html2text
reload(sys)
sys.setdefaultencoding('utf-8')
html = html()
__ = html2text.HTML2Text()
from subprocess import call, Popen, PIPE
import json
id_call = Popen(["wp", "--path=/var/www/html/", "post", "list", "--format=ids"], stdout=PIPE)
ids = id_call.stdout.read().split(' ')
marker_id_call = Popen(["wp", "post", "list", "--post_type='marker-icon'", "--format=ids"], stdout=PIPE)
marker_ids = marker_id_call.stdout.read().split(' ')
att_id_call = Popen(["wp", "post", "list", "--post_type='attachment'", "--format=json", "--fields=ID,post_parent"], stdout=PIPE)
att_ids = json.loads(att_id_call.stdout.read())
@virgilio
virgilio / MockParcel.java
Created June 2, 2016 21:57 — forked from Sloy/MockParcel.java
MockParcel for testing Parcelables implementations with the new Android's Unit testing support (http://tools.android.com/tech-docs/unit-testing-support). Only String and Long read/write implemented here. Add mock methods for other types.
import android.os.Parcel;
import java.util.ArrayList;
import java.util.List;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doAnswer;
@virgilio
virgilio / ArraysAsList.java
Created May 11, 2016 18:40
Arrays as list
// Array to list snippet
// Returns a ArrayList of String! Great for inline initialization of Lists and its implementations
Arrays.asList("oi", "tudo", "bem",
"Jovem!", "Sucesso aí?", "É nois que voa bruxão")
#!/usr/bin/env python
import sys
import subprocess
import csv
def search(argv):
for arg in argv:
if arg != 'ft.py' and arg != 'python' and arg != './ft.py':
subprocess.call(['/bin/grep', '-i', arg, 'trans.csv'])
$("a[href='#topo']").click(function(){
$("html,body", window.parent.document).scrollTop(0);
return false;
});
$("#lista_indice_gramatica ul li a").each(function(){
$("html, body", window.parent.document)
.scrollTop($($(this).attr("href")).offset().top);
});
<?php
/*
* Plugin Name: Custom E-mail
* Description: Enabling this module will initialize custom e-mails. You will then have to configure the settings via the "E-mail" tab.
*
* Holds Theme My Login Custom E-mail class
*
* @package Theme_My_Login
* @subpackage Theme_My_Login_Custom_Email
* @since 6.0
@virgilio
virgilio / dabblet.css
Created September 12, 2013 14:52
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;