Skip to content

Instantly share code, notes, and snippets.

View gcpantazis's full-sized avatar

George Pantazis gcpantazis

View GitHub Profile
@gcpantazis
gcpantazis / getPlaceholder
Last active December 20, 2015 18:49
Use ImageMagick's `identify` command to create a CLI command for evaluating images and getting a same-sized placeholder.
#!/bin/bash
echo "http://placehold.it/$(identify $1 | sed -n 's/.* \([0-9][0-9]*x[0-9][0-9]*\) .*/\1/p')"
@gcpantazis
gcpantazis / gist:6092838
Last active December 20, 2015 07:19
OpenCV, rotate an image 180 degrees.
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main(int argc, char* argv[])
{
Mat src_img, dst_img;
# Installing OpenCV python libs on mac to work with virtualenv
# OpenCV 2.4.3
# Python 2.7.3 installed with brew
# assuming you have virtualenv, pip, and python installed via brew
# assuming $WORKON_HOME is set to something like ~/.virtualenvs
# using homebrew - make sure we're current
brew update
@gcpantazis
gcpantazis / gist:6059042
Last active December 20, 2015 02:49
A rough idea for establishing the data models for a module within the module itself, for a future generator with a CMS tie-in.
// schema/killer-thing.json
{
"parents": ["Grid", "Container"], // Grids and Containers can add KillerThing as a submodule.
"model": {
"foo": "String",
"bar": "Integer",
"baz": "Boolean",
"a": ["CoolThing"], // An Array of CoolThing Models.
"b": "RadThing" // A single RadThing Model.
@gcpantazis
gcpantazis / router.js
Last active December 17, 2015 15:29
Lightweight Backbone-ish Router
// Router Module
// --------------------------------------------
//
// * **Class:** Router
// * **Version:** 0.1
// * **Modified:** 05/01/2013
// * **Author:** George Pantazis
//
// This class is a lightweight extraction of Backbone's router object. For more information, please
// refer to [that project's documentation](http://backbonejs.org/#Router).
@gcpantazis
gcpantazis / gist:5447085
Last active December 16, 2015 14:09
Exposing jQuery plugins via require, instead of accessing them via the jQuery global object.
// Returning the jQuery plugin at the end of its requirejs module.
return function( $elem, options ) {
return $elem.someJQueryPlugin.apply($elem, Array.prototype.slice.call( arguments, 1 ));
};
// Instead of this:
$foo.someJQueryPlugin({'bar': true});
// views needed, generated by the back-end.
var views = ['an', 'array', 'of', 'views'];
require(['libraries'], function () {
require(['global', 'plugins'], function(){
require(['models', 'collections'], function(){
require(views);
});
});
});
{
"theme": "Soda Dark.sublime-theme",
"draw_white_space": "all",
"rulers": [75, 100],
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"tab_size": 2
}
@gcpantazis
gcpantazis / gist:4254458
Last active October 13, 2015 20:48
Setup Procedure for new Dev Machines
@gcpantazis
gcpantazis / gist:3955842
Created October 25, 2012 22:22
Git exports and reference
# Export all the files changed since commit COMMIT-ID-OR-ALIAS
tar czvf changed-files.tar.gz -T <(git diff --name-only COMMIT-ID-OR-ALIAS..)