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 | |
//Create new instance of phpQuery with the poorly formatted HTML string | |
phpQuery::newDocument($document_html_string); | |
$my_data = array(); //Init array for holding the records | |
foreach(pq("#main table tr") as $block) { | |
//Get the key/value by selecting the table header element. | |
//We namespace it to the current block so we don't | |
// get _all_ the page's TH elements. | |
$key = pq('th', $block)->text(); |
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 | |
//Get the HTML string from cURL | |
//Create new instance of phpQuery | |
//We assume the phpoQuery library is included at the top or your script. | |
phpQuery::newDocument($document_html_string); | |
$inputs = array(); //Create an empty array to hold the inputs. | |
//Get all the inputs on the page and put them in an array. | |
foreach(pq(':input') as $id => $block) { |
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
/* | |
* Example implementation | |
*/ | |
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation | |
{ | |
NSLog(@"Launched with URL: %@", url.absoluteString); | |
NSDictionary *userDict = [self urlPathToDictionary:url.absoluteString]; | |
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
require.paths.unshift( | |
__dirname + '/codejam/support/express/support/connect/lib/' | |
, __dirname + '/codejam/support/express/support/jade/lib/' | |
, __dirname + '/codejam/support/' | |
) | |
var express = require("express") |
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
//Basic Usage: | |
$().framerate() | |
//Usage w/options: | |
$().framerate({framerate: 24, logframes: true}) |
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 there_can_be_only_one_highlander(the_one) { | |
var state_speed = 500, | |
immortals = ['#welcome-box', '#guest-box', '#login-box', '#register-box'], | |
to_kill = [], | |
key = null; | |
for (key in immortals) { | |
if (immortals[key] !== the_one) { | |
if (typeof immortals[key] === 'string') { | |
to_kill.push(immortals[key]); |
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
#Update the crucial options | |
UPDATE wp_options | |
SET option_value = 'http://newdomain.com' | |
WHERE option_name in ('siteurl', 'home'); | |
#Make sure search engines can access the deployed site | |
UPDATE wp_options | |
SET option_value = 1 | |
WHERE option_name = 'blog_public'; | |
#Set the GUIDs to have the correct domain | |
UPDATE wp_posts |
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 | |
/** | |
* Generates a uristub of maximum specified length. | |
* | |
* @access protected | |
* @param string $tableName The name of the table to query | |
* @param string $tableField The table column to check | |
* @param string $uristub The initial input string (page title) to clean | |
* @param int $length The maximum allowable length for the clean url | |
* @param mixed $iteration The current iteration, when duplicates found |
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() { | |
// for storing states | |
var states = []; | |
// cache some elems | |
var $states = $('#state'); | |
var $stateList = $('#state-list'); | |
// hide the dropdown and pull values | |
$states.hide().find('option').each(function() { |
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 | |
// the below code assumes you have the private/protected | |
// variable $this->_db set to your database adapter. | |
// begin the transaction | |
$this->_db->beginTransaction(); | |
try { | |
// mock insert into a user table | |
$result = $this->_db->insert('users', array( |