Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃
working ...

Dimas Begunoff farinspace

🙃
working ...
View GitHub Profile
View NGINX CodeIgniter Config
# NGINX CodeIgniter Config
server
{
server_name .organizetheweb.com;
access_log /var/log/nginx/organizetheweb.com.access.log;
root /var/www/organizetheweb.com/trunk;
View wpalchemy_time_ago
<?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(); }
View Links metabox code
View functions.php
<?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
(
View repeating_fields_meta.php
<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>
View gist:822101
<?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
Repeating fields Javascript
View repeating_fields.js
// 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');
View repeating_fields_setup.html
<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"/>
View 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 Jul 6, 2011
PHP function to clean an array recursively
View php_clean_function.php
function clean(&$arr)
{
if (is_array($arr))
{
foreach ($arr as $i => $v)
{
if (is_array($arr[$i]))
{
clean($arr[$i]);
You can’t perform that action at this time.