This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My version of an app template, modified by James Cox (imajes) | |
# SUPER DARING APP TEMPLATE 1.0 - By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/src/git/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hazards = Hazard.find :all | |
states = State.find :all | |
for hazard in hazards | |
for state in states | |
sorted_mats = Array.new | |
total_storage = 0.0000 | |
total_closed = 0.0000 | |
total_open = 0.0000 | |
for proj_mat in @project.project_materials |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$my_post = get_post($my_id = 12); | |
echo $my_post->post_title; | |
echo $my_post->post_content; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static e_STATE current_state; | |
void main_thread() | |
{ | |
switch(current_state) | |
{ | |
case STATE_A: | |
state_a(); | |
break; | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "sm.h" | |
static state_e current_state; | |
static void state_a_entry(void); | |
static void state_a_exit(void); | |
static void message_a_handler(void); | |
static void message_b_handler(void); | |
static void message_c_handler(void); | |
static const state_t state_list[] = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sss_excerpt($string, $count, $string_tags = TRUE){ | |
//it's blank, just return. | |
if ( '' == $string) return $string; | |
$string = str_replace(']]>', ']]>', $string); | |
$string = strip_tags($string); | |
$words = explode(' ', $string, $count + 1); | |
if (count($words)> $count) { | |
array_pop($words); | |
$string = implode(' ', $words); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_image_from_content($content) { | |
// Define the pattern to search | |
$szSearchPattern = '~<img [^\>]*\ />~'; | |
// Run preg_match_all to grab all the images and save the results in $aPics | |
preg_match_all( $szSearchPattern, $content, $aPics ); | |
// Count the results | |
$iNumberOfPics = count($aPics[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function convert_state($name, $to='name') { | |
$states = array( | |
array('name'=>'Alabama', 'abbrev'=>'AL'), | |
array('name'=>'Alaska', 'abbrev'=>'AK'), | |
array('name'=>'Arizona', 'abbrev'=>'AZ'), | |
array('name'=>'Arkansas', 'abbrev'=>'AR'), | |
array('name'=>'California', 'abbrev'=>'CA'), | |
array('name'=>'Colorado', 'abbrev'=>'CO'), | |
array('name'=>'Connecticut', 'abbrev'=>'CT'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emails don't match | |
email already taken | |
email not valid | |
email and password don't match | |
you must accept terms | |
email not found | |
password too short | |
you have already bought this video | |
you have already rented this video |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"album_order" = "{\"count\":3,\"album_order\":{\"36\":{\"zebra\":\"zebra\"},\"count\":3,\"album_order\":{\"35\":{\"album\":\"album\"},\"count\":\"1\",\"album_order\":{\"0\":{\"album_id\":\"34\",\"name\":\"from ios\",\"url_name\":\"from-ios\"}}}}}"; | |
email = "[email protected]"; | |
id = 2; | |
layout = tiled; | |
name = "Wes Billman"; | |
"site_name" = wes; | |
"site_url" = wes; | |
theme = light; | |
} |
OlderNewer