Skip to content

Instantly share code, notes, and snippets.

View farinspace's full-sized avatar
🙃
working ...

Dimas Begunoff farinspace

🙃
working ...
View GitHub Profile
# NGINX CodeIgniter Config
server
{
server_name .organizetheweb.com;
access_log /var/log/nginx/organizetheweb.com.access.log;
root /var/www/organizetheweb.com/trunk;
<?php
// src: http://www.sajithmr.me/php-time-ago-calculation/
function wpalchemy_time_ago($datefrom,$dateto=-1)
{
// Defaults and assume if 0 is passed in that
// its an error rather than the epoch
if($datefrom<=0) { return "A long time ago"; }
if($dateto==-1) { $dateto = time(); }
<?php
define('_TEMPLATEURL', WP_CONTENT_URL . '/themes/' . basename(TEMPLATEPATH));
include_once 'WPAlchemy/MetaBox.php';
if (is_admin()) wp_enqueue_style('custom_meta_css', _TEMPLATEURL . '/custom/meta.css');
$repeating_mb = new WPAlchemy_MetaBox(array
(
<div class="my_meta_control">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras orci lorem, bibendum in pharetra ac, luctus ut mauris.</p>
<p><a href="#" class="dodelete-docs button">Remove All</a></p>
<?php while($mb->have_fields_and_multi('docs')): ?>
<?php $mb->the_group_open(); ?>
<a href="#" class="dodelete button">Remove</a>
<?php $pages = get_pages(); ?>
<?php while( $mb->have_fields_and_multi( 'buttons' ) ) : ?>
<?php $mb->the_group_open(); ?>
<div class="button">
<a href="#" class="dodelete button">Remove</a>
<?php $mb->the_field('s_field'); ?>
<select name="<?php $mb->the_name(); ?>">
<option></option>
@farinspace
farinspace / repeating_fields.js
Created May 27, 2011 04:49
Repeating fields Javascript
// disable all fields in a template (so they do not get submitted)
$('.template').find('input, textarea, select, button').each(function()
{
$(this).attr('disabled', 'disabled');
});
function doRepeat(replace)
{
var container = $(this).closest('.container');
@farinspace
farinspace / repeating_fields_setup.html
Created May 27, 2011 04:59
Repeating fields Setup
<div class="container">
<div class="collection">
<div class="template" style="display:none;">
<input type="text" name="questions[%][question]" value="qq"/>
<input type="text" name="questions[%][type]" value="qt"/>
@farinspace
farinspace / upcoming list
Created June 21, 2011 20:00
upcoming list
<?php
global $am_option;
?>
<div class="post">
<h2 class="home_title">UPCOMING:</h2>
<div class="box">
<div class="holder">
<div class="frame">
<?php global $custom_metabox; ?>
<?php query_posts('post_type=events&showposts=3'); ?>
@farinspace
farinspace / php_clean_function.php
Created July 6, 2011 23:35
PHP function to clean an array recursively
function clean(&$arr)
{
if (is_array($arr))
{
foreach ($arr as $i => $v)
{
if (is_array($arr[$i]))
{
clean($arr[$i]);