Skip to content

Instantly share code, notes, and snippets.

View atticoos's full-sized avatar
🧑‍💻
building Rally

Atticus White atticoos

🧑‍💻
building Rally
View GitHub Profile
@atticoos
atticoos / app.js
Created February 10, 2012 02:54 — forked from alexburner/app.js
Proof of Concept for Titanium implementation of Facebook/Path sidebar
Titanium.UI.setBackgroundColor('red');
// root
var rootWin = Ti.UI.createWindow({
title: 'Root Win',
backgroundColor: 'gray',
tabBarHidden: true,
navBarHidden: true
});
@atticoos
atticoos / Shopp::Item::match.php
Last active December 17, 2015 19:19
Solution for matching "Input name" and "Input value" fields for Shopp's Promotion component.
<?php
/* Updated match function */
function match ($rule) {
extract($rule);
switch($property) {
case 'Any item name': $subject = $this->name; break;
case 'Any item quantity': $subject = (int)$this->quantity; break;
case 'Any item amount': $subject = $this->total; break;
-- EXAMPLE QUERY FOR USER'S primary address:
SELECT A.address1, A.address2, A.city, A.state, A.zip FROM users U
LEFT JOIN users_addresses UA ON U.id = A.user
LEFT JOIN address A ON UA.address = A.id
WHERE UA.primary = 1 AND UA.deleted = 0;
-- ADDRESS
CREATE TABLE IF NOT EXISTS `addresses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`address1` varchar(225) NOT NULL,
@atticoos
atticoos / Singular Post Type
Created June 20, 2013 22:07
How to make a singular post type
add_action('admin_menu', 'hook_uniquePostTypes');
function hook_uniquePostTypes(){
global $submenu, $menu;
// post types to make singular
$postTypes = array('example1', 'example2');
foreach($submenu as $key=>$value){
$name = preg_replace('/edit.php\?post_type\=/', '', $key);
foreach($postTypes as $type){
import javax.swing.JOptionPane;
public class Salary1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
//define the variables for the input box
<h1>Shopping Cart</h1>
{% if cart.item_count > 0 %}
<form action="/cart" method="post">
<table>
<thead>
<tr>
<?php
function card_month_options(){
$months = array('01','02','03','04','05','06','07','08','09','10','11','12');
foreach ($months as $month): ?>
<option value="<?php echo $month; ?>"><?php echo $month; ?></option>
<?php endforeach;
<?php get_header(); ?>
<div id="main-content">
<h2><?php the_title(); ?></h2>
<p><?php the_content(); ?></p>
</div>
<div id="sidebar">
First sidebar:
<?php get_sidebar(); ?>
public class Person
{
private Head head;
private Torsoe torsoe;
private Arm leftArm;
private Arm rightArm;
private Leg leftLeg;
private Leg rightLeg;
}
(function () {
"use strict";
console.log("Today", new Date().getDay());
function daysBetween(date1, date2) {
return (date1 - date2) / (1000 * 60 * 60 * 24);
}