Skip to content

Instantly share code, notes, and snippets.

View merianos's full-sized avatar

Merianos Nikos merianos

View GitHub Profile
@merianos
merianos / 0_reuse_code.js
Created December 10, 2013 14:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@merianos
merianos / javascript_resources.md
Created December 10, 2013 14:52 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@merianos
merianos / python_resources.md
Created December 10, 2013 14:52 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@merianos
merianos / functions.php
Last active December 5, 2015 13:20
Informing the Page Builder for the location of your widgets
function register_my_widgets_folder( $folders = array() ) {
$folders[] = dirname( __FILE__ ) . '/widgets/';
return $folders;
}
add_filter( 'siteorigin_widgets_widget_folders', 'register_my_widgets_folder' );
@merianos
merianos / functions.php
Last active December 5, 2015 13:54
Explain Page Builder how to load your widgets
function manually_load_widgets() {
$widgets_folder = dirname( __FILE__ ) . '/widgets/';
$contents = scandir( $widgets_folder );
foreach( $contents as $item ) {
if ( '.' === $item || '..' === $item || !is_dir( $widgets_folder . $item ) ) {
continue;
}
foreach ( glob( $widgets_folder . $item . '/*.php' ) as $file ) {
@merianos
merianos / functions.php
Created December 5, 2015 13:47
Allow PageBuilder to see your custom fields
function register_unique_namespace( $class_prefixes = array() ) {
$class_prefixes[] = 'My_Custom_Field_';
return $class_prefixes;
}
add_filter( 'siteorigin_widgets_field_class_prefixes', 'register_unique_namespace' );
function register_my_custom_fields_folder( $class_paths = array() ) {
$class_paths[] = dirname( __FILE__ ) . '/fields/';
@merianos
merianos / functions.php
Created December 5, 2015 13:50
Loading custom fields in PageBuilder
function load_custom_fields() {
$base_dir = dirname( __FILE__ ) . '/fields/';
foreach ( glob( $base_dir . '*.php' ) as $file ) {
require_once $file;
}
}
add_action( 'admin_init', 'load_custom_fields' );
@merianos
merianos / functions.php
Created December 5, 2015 13:57
PageBuilder final result
function register_my_widgets_folder( $folders = array() ) {
$folders[] = dirname( __FILE__ ) . '/widgets/';
return $folders;
}
add_filter( 'siteorigin_widgets_widget_folders', 'register_my_widgets_folder' );
function manually_load_widgets() {
$widgets_folder = dirname( __FILE__ ) . '/widgets/';
$contents = scandir( $widgets_folder );
@merianos
merianos / text-align.less
Created December 6, 2015 08:22
Less implementation of text align per column
@align: left, right, center, justify;
@screen : @screen-sm-min, @screen-md-min, @screen-lg-min;
@sizes : sm, md, lg;
.createMediaQueryRules( @mediaIterator:1 ) when ( @mediaIterator <= length( @screen ) ) {
@mediaQuery : extract( extract( @screen, @mediaIterator ), 1 );
@size : extract( extract( @sizes, @mediaIterator ), 1 );
@media ( min-width : @mediaQuery ) {
.createTextAlignRules( @iterator:1 ) when ( @iterator <= length( @align ) ) {
@merianos
merianos / text-align.scss
Created December 6, 2015 08:35
Sass implementation of text align per column
$screens : $container-sm, $container-md, $container-lg;
$sizes : sm, md, lg;
$aligns : left, right, center, justify;
$count : 0;
@each $screen in $screens {
$count : $count + 1;
@media ( min-width: #{$screen} ) {
$size : nth($sizes, $count);