Skip to content

Instantly share code, notes, and snippets.

View macedd's full-sized avatar
🐋
Looking for growth opportunities

Thiago F Macedo macedd

🐋
Looking for growth opportunities
View GitHub Profile
@macedd
macedd / yaffey-qt5.patch
Created June 11, 2014 23:38
Yaffey Patch for QT5 Compilation (ubuntu 12, 13, 14)
diff -rupN yaffey-orig/main.cpp yaffey-qt5/main.cpp
--- yaffey-orig/main.cpp 2014-06-11 20:01:50.155769286 -0300
+++ yaffey-qt5/main.cpp 2014-06-11 20:24:07.659482714 -0300
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
-#include <QtGui/QApplication>
+#include <QApplication>
@macedd
macedd / gist:4c8e962b898eaa06fde0
Created November 20, 2014 23:35
magnificPopup to allow youtube playlists and embeded videos
$.extend(true, $.magnificPopup.defaults, {
// Allow embed youtube (playlist, etc)
iframe: {
patterns: {
youtube: {
index: 'youtube.com',
id: function(src)
{
// link pattern
var mt = src.match(/v=([^&]+)(&(.*))?/);
@macedd
macedd / force-autoplay.js
Created February 4, 2015 23:15
WP Video (mediaelementjs) force autoload
$(window).on('load', function() {
var player = $('video.wp-video-shortcode').data('mediaelementplayer');
player.options.success = function(media, dom) {
if (media.pluginType === 'flash') {
media.addEventListener('canplay', function() {
// Player is ready
media.play();
}, false);
} else {
media.play();
@macedd
macedd / Csv_Writer.php
Last active August 29, 2015 14:16
Large Dataset Csv Writer Class
<?php
class Csv_Writer
{
public $stream, $wrote = false;
function __construct() {
header( 'Content-Type: text/csv' );
$this->stream = fopen('php://output', 'w');
}
@macedd
macedd / Gruntfile.js
Created March 18, 2015 07:01
SSH Remote IPython Console Grunt Commands
/**
* IPython Commands
*/
shell: {
ipnb_kernel: {
command: 'ssh me@server "nohup ipython kernel &> kernel.log &"'
},
ipnb_kernel_json: {
command: 'rsync -t me@server:~/.ipython/profile_default/security/kernel* ./kernel/'
},
@macedd
macedd / gist:85d787e9a436ca19969d
Last active August 29, 2015 14:23
remove duplicate spaces from field while typing
$('textarea').on('keyup', function() {
// store cursor location
var start = this.selectionStart,
end = this.selectionEnd,
len = this.value.length;
// remove duplicate spaces from field
$(this).val(
this.value.trim()
.replace(/(\n\n)+/g, '\n')
@macedd
macedd / gist:1c201a9de84fb893d138
Created July 3, 2015 20:09
Responsive Triangle Less Mixin
/**
Based on the work:
- http://jsfiddle.net/josedvq/3HG6d/
- http://codeitdown.com/css-triangles-responsive/
*/
.responsive-triangle-base(@size; @color;) {
width: @size/2;
height: 0;
@macedd
macedd / gist:61fe1f806bf3cf030a22
Created July 5, 2015 01:16
Python Class: Google Image Search Api
import urllib2, urllib
import simplejson
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
class ImageApi(object):
uri = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&%s"
params = { 'q': 'term', 'imgsz': 'medium|large|xlarge', 'start': 0, 'imgtype': 'photo' }
@macedd
macedd / app.php
Created August 23, 2015 03:59
Lumen MongoDB Setup
$app->register('Jenssegers\Mongodb\MongodbServiceProvider');
$app->withEloquent();
$app->withFacades();
config(['database.connections.mongodb' => array(
'driver' => 'mongodb',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 27017),
'username' => env('DB_USERNAME'),
@macedd
macedd / git_stats_generate.sh
Last active September 21, 2021 06:43
Generate Stats for a Git Repository
# Tools installation
pip install gitinspector
gem install git_stats
# Generate the reports
cd git_proj
git_stats generate
gitinspector -f php,js,less -F html > git_stats/inspector.html
# Generate time-sheets