Skip to content

Instantly share code, notes, and snippets.

@hectorlorenzo
hectorlorenzo / center_content
Created August 19, 2014 08:45
Centers content vertically and horizontally
<div style="display: table; width: 100%; height: 100%;">
<div style="display: table-cell; vertical-align: middle;">
<!-- Content -->
</div>
</div>
@hectorlorenzo
hectorlorenzo / wordpress-gitignore
Last active August 29, 2015 14:13
.gitignore file for fresh Wordpress installations
# ------------------------------------------
# GITIGNORE FOR WORDPRESS
# Really simple .gitignore for new Wordpress intallations.
# User created plugins or themes have to be manually included in it.
# ------------------------------------------
# Ignore everything except the wp-content folder (because it contains the themes
# and plugins), and the gitignore file itself
/*
!.gitignore
@hectorlorenzo
hectorlorenzo / get_attached_images
Created January 29, 2014 06:57
Simple Wordpress function to get the attached images that belong to a specific post.
// get all attachments from a post, except the featured image
function get_attached_images ( $post_ID, $featured_image = false ) {
$args = array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'post_parent' => $post_ID
);
// do we want the featured image?
@hectorlorenzo
hectorlorenzo / SS_BlankStripObject.php
Created March 24, 2016 02:47
SilverStripe blank Strip object
<?php
class ExampleStrip extends Strip
{
//-------------------------------------------- DB model
/**
* @var array
*/
private static $db = [
@hectorlorenzo
hectorlorenzo / SS_TextField.php
Created March 24, 2016 02:49
SilverStripe text field
$fieldName = new TextField('FieldName', 'Field name', null, 255);
@hectorlorenzo
hectorlorenzo / constantsWrapper.js
Created July 17, 2016 07:02
Simple constants wrapper for Dashboard project
export default function (namespace) {
return {
update: namespace + '.UPDATE',
ready: namespace + '.READY'
}
}
@hectorlorenzo
hectorlorenzo / ApiWrapper.js
Last active July 17, 2016 07:02
API Wrapper for the Dashboard project
let ApiCalls = {
businessId: '',
moduleId: '',
formId: '',
type: '',
parentId: '',
baseUrl: '//admin:d360staging@api.dashboard.v2.digital360.com.au/',
apiUrl: '',
/**
import ApiWrapper from './apiwrapper'
import JeevesAbstract from './JeevesAbstract'
import {EventEmitter} from 'events'
let Jeeves = Object.assign({}, JeevesAbstract, EventEmitter, {
items: {
businessSegments: []
},
namespace: 'BUSINESS_SEGMENTS',
import ConstantsWrapper from './constantsWrapper'
export default {
items: [],
/**
* We define a set of namespaced constants to avoid collision of EventEmitter
* between modules
*
* @return {Object} Dictionary of namespaced actions
import initMixin from './internal/init'
import stateMixin from './internal/state'
import eventsMixin from './internal/events'
import lifecycleMixin from './internal/lifecycle'
import miscMixin from './internal/misc'
import dataAPI from './api/data'
import domAPI from './api/dom'
import eventsAPI from './api/events'
import lifecycleAPI from './api/lifecycle'