Skip to content

Instantly share code, notes, and snippets.

<?php
$url="http://weather.yahoo.com/forecast/USMA0009.html";
$file_contents = file_get_contents($url);
$divStart = '<div class="forecast-icon"';
$strEnd = "'); _background-image/* */: none;";
$start = strpos($file_contents, $divStart) + 50;
<a href="http://twitter.com/jonwasson"><img src="URL FOR TWITTER ICON HERE" /></a>
<a href="http://twitter.com/jonwasson"><img src="URL FOR TWITTER ICON HERE" /></a>
/*
* Currently an example script (disabled)> Copy as your own script, and modify
* the Listener command as shown below
*
* Menu: Synchronize > Upload Current File On Save
* Key: M1+S
* Kudos: Ingo Muschenetz
* License: EPL 1.0
* Listener: commandService().addExecutionListener(this);
* DOM: http://localhost/com.aptana.ide.syncing.doms
#!/bin/bash -e
git checkout integration
for branch in `git branch | tr '*' ' '`; do
if [ "$branch" != "master" ]; then
if [ "$branch" != "integration" ]; then
git branch -D $branch;
fi;
fi;
done;
git remote update
<project name="build" default="help">
<target name="help">
<exec command="phing -h" passthru="true" />
</target>
<target name="load.subversion">
<property file="subversion.properties" />
</target>
<html>
<head>
<title>Moving to Oklahoma City</title>
<?
function listitems($url) {
$buffer = file_get_contents($url);
$xml = new SimpleXMLElement($buffer);
echo "<ul>";
@jmccartie
jmccartie / convert_state.rb
Created December 8, 2010 18:13
converts state short name to long name
# Converts two-letter state to full-state name
def state_name(state_abbr)
states = {:AK => "Alaska", :AL => "Alabama", :AS => "American Samoa", :AZ => "Arizona", :AR => "Arkansas", :CA => "California", :CO => "Colorado", :CT => "Connecticut", :DE => "Delaware", :DC => "District of Columbia", :FM => "Federated States of Micronesia", :FL => "Florida", :GA => "Georgia", :GU => "Guam", :HI => "Hawaii", :ID => "Idaho", :IL => "Illinois", :IN => "Indiana", :IA => "Iowa", :KS => "Kansas", :KY => "Kentucky", :LA => "Louisiana", :ME => "Maine", :MH => "Marshall Islands", :MD => "Maryland", :MA => "Massachusetts", :MI => "Michigan", :MN => "Minnesota", :MS => "Mississippi", :MO => "Missouri", :MT => "Montana", :NE => "Nebraska", :NV => "Nevada", :NH => "New Hampshire", :NJ => "New Jersey", :NM => "New Mexico", :NY => "New York", :NC => "North Carolina", :ND => "North Dakota", :MP => "Northern Mariana Islands", :OH => "Ohio", :OK => "Oklahoma", :OR => "Oregon", :PW => "Palau", :PA => "Pennsylvania", :PR => "Puer
@jmccartie
jmccartie / git deploy.sh
Created December 10, 2010 21:30
Clone repo, prompt for hash, checkout hash, symlink production folder
#!/bin/bash -e
# Set the variables below to match what your setup should be
#
# Your repo URL
# Example: clone_url=git@github.com:jmccartie/php-url-shortener.git
clone_url=
#
@jmccartie
jmccartie / deploy.sh
Created January 8, 2011 13:57
runs local git commands, then deploys to production
# PAUSE
echo "This script will merge integration into master, then deploy to production. Continue? (Y/n)"
read ANSWER
if [[ "$ANSWER" != "Y" ]]; then
exit 0
fi
git remote update
git checkout integration
git rebase origin/integration