Skip to content

Instantly share code, notes, and snippets.

View esgy's full-sized avatar
🏠
Working from home

Sorin Gitlan esgy

🏠
Working from home
View GitHub Profile
@esgy
esgy / post_types.php
Created November 13, 2012 17:28
create new post types wordpress
// Using JW_Post_Type.php
$product = new PostType("movie");
$product->add_taxonomy('Actor');
$product->add_taxonomy('Director');
$product->add_meta_box('Movie Info', array(
'name' => 'text',
'rating' => 'text',
'review' => 'textarea',
'Profile Image' => 'file'
@esgy
esgy / JW_Post_Type.php
Created November 13, 2012 17:29
JW_Post_Type.php for Wordpress
<?php
// include this JW_Post_Type.php into function.php
session_start();
/**
* JW Post Types
* @author Jeffrey Way
* @link http://jeffrey-way.com
*/
@esgy
esgy / move_wordpress.php
Created November 13, 2012 17:32
MOVING WORDPRESS
// Details here: http://codex.wordpress.org/Moving_WordPress
// For safe database changes:
// 1. Only perform a search and replace on the wp_posts table to not break the serialized data.
// 2. OR Use a utility script: https://github.com/interconnectit/Search-Replace-DB
@esgy
esgy / gist:4110083
Created November 19, 2012 10:51
javascript typeof helper
Object.toType = (function toType(global) {
return function(obj) {
if (obj === global) {
return "global";
}
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
}
})(this)
@esgy
esgy / singleton.js
Created November 20, 2012 16:01
js: Singleton pattern
var SingletonTester = (function()
{
//args: an object containing arguments for the singleton
function Singleton(args) {
//set args variable to args passed or empty object if none provided.
var args = args || {};
//set the name parameter
this.name = 'SingletonTester';
//set the value of pointX
this.pointX = args.pointX || 6; //get parameter from arguments or set default
@esgy
esgy / module.js
Created November 20, 2012 16:08
js: module pattern
var someModule = function(){
//private attributes
var privateVar = 5;
//private methods
var privateMethod = function(){
return 'Private Test';
};
return {
//public attributes
@esgy
esgy / revealingmodule.js
Last active October 13, 2015 01:38
js: revealing module
/*
The idea here is that you have private methods
which you want to expose as public methods.
What are are doing below is effectively defining
a self-executing function and immediately returning
the object.
*/
var myRevealingModule = function(){
var name = 'John Smith';
@esgy
esgy / protopatern.js
Created November 20, 2012 16:09
js: prototype pattern
// No need for capitalization as it's not a constructor
var someCar = {
drive: function() {};
name: 'Mazda 3'
};
// Use Object.create to generate a new car
var anotherCar = Object.create(someCar);
anotherCar.name = 'Toyota Camry';
@esgy
esgy / wp-post-meta.php
Created November 26, 2012 15:06
wordpress get post meta - custom fields
$heading_image = get_post_meta($post->ID,"pageThumb",true);
@esgy
esgy / Contract Killer 3.md
Created December 8, 2012 11:40 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.