Skip to content

Instantly share code, notes, and snippets.

View not-only-code's full-sized avatar
👾
Looking for work!

Carlos Sanz García not-only-code

👾
Looking for work!
View GitHub Profile
@not-only-code
not-only-code / server.js
Last active August 29, 2015 14:07
Create static server easily
var static = require('node-static');
//
// Create a node-static server instance to serve the './public' folder
//
var file = new static.Server('./public');
require('http').createServer(function (request, response) {
request.addListener('end', function () {
//
@not-only-code
not-only-code / dabblet.css
Created July 25, 2013 14:08
Flexible Field layout
/**
* Flexible Field layout
*/
body {
background: #f4f4f4;
color: #444;
font: 16px/1.2em Helvetica, Arial, Sans-serif;
}
@not-only-code
not-only-code / dabblet.css
Created July 25, 2013 12:45 — forked from anonymous/dabblet.css
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
* {
margin: 0;
padding: 0
}
ul {
@not-only-code
not-only-code / dabblet.css
Created July 25, 2013 12:23
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
* {
margin: 0;
padding: 0
}
ul {
@not-only-code
not-only-code / main.coffee
Last active December 18, 2015 21:49
Backbone custom REST API urls
###
This test use Apiari.io REST sketch
###
class MyModel extends Backbone.Model
rootUrl: 'http://backbonecustomrest.apiary.io'
customUrls:
'read': '/my-path/1/get'
'create': '/my-path/1/create'
'update': '/my-path/1/update'
'delete': '/my-path/1/delete'
<?php
function _register_post_type( $post_type = '', $args = array() ) {
if ( empty( $post_type ) )
return;
$singular = empty( $args['singular'] ) ? $post_type : $args['singular'];
$singular = str_replace( '_', ' ', $singular );
$singular = ucwords( $singular );
$plural = empty( $args['plural'] ) ? "{$singular}s" : $args['plural'];
$plural = ucwords( $plural );
@not-only-code
not-only-code / functions.php
Last active December 14, 2015 01:09
return only the top level terms of the object/s
/**
* get top level object terms
* @package default
* @version 1.0
**/
function _get_object_parent_terms ($object, $taxonomies, $args = array()) {
$object_terms = wp_get_object_terms($object, $taxonomies, $args);
$output = array();
@not-only-code
not-only-code / gist:4562606
Last active December 11, 2015 06:58
Effectively Containing Floats, a better clearfix technique
/* Effectively Containing Floats · @shayhowe · http://www.shayhowe.com */
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
@not-only-code
not-only-code / functions.php
Created December 7, 2012 12:59
Theming Jigoshop: create your custom product types
/**
* Helper functions to add / remove array of terms
*
* @package MyTheme
* @since 1.0
*
**/
function _add_terms( $terms, $taxonomy = 'category' ) {
if ( !is_array($terms) || empty($terms)) return;
@not-only-code
not-only-code / dabblet.css
Created December 6, 2012 19:34
stitched-effect
div {
margin: 50px auto;
}
/**
* stitched-effect
*/
.stitched-effect {
position: relative;
width: 300px;