Skip to content

Instantly share code, notes, and snippets.

View danoc's full-sized avatar

Daniel O’Connor danoc

View GitHub Profile
@danoc
danoc / Current Temperature
Created January 16, 2012 20:50
Use SimpleXML and Google's (unofficial) Weather API to display the current temperature for a city.
<?php
// Use SimpleXML and Google's (unofficial) Weather API
//to display the current temperature for a city.
$zip = 13902; // change to desired city
$weather = simplexml_load_file('http://www.google.com/ig/api?weather='.$zip);
$city = $weather->weather->forecast_information->city['data']; // city name
$degrees = $weather->weather->current_conditions->temp_f['data']; // current temperature
<?php
function get_custom_excerpt($text, $length)
{
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]&gt;', $text);
$text = strip_tags($text);
$excerpt_length = apply_filters('excerpt_length', $length);
@danoc
danoc / time_since.php
Created May 19, 2013 23:12
A function that returns a "human-readable" time such as 8 hours ago or 1 month ago.
<?php
/**
* Return a "human-readable" time such as 8 hours ago.
*
* @param string $time such as: 2013-03-18 21:13:59
*/
function time_since($time)
{

Keybase proof

I hereby claim:

  • I am danoc on github.
  • I am danoc (https://keybase.io/danoc) on keybase.
  • I have a public key whose fingerprint is CFF0 9260 DAA0 440E 656C 1555 9433 DFB5 21C4 DFBE

To claim this, I am signing this object:

@danoc
danoc / SassMeister-input.scss
Created July 18, 2015 00:58
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
$list-tree-chain-base: '.list-tree__list';
$list-tree-chain: '';
$list-tree-chain-tail: '.list-tree__item';
$max-supported-tree-depth: 30;
@danoc
danoc / SketchSystems.spec
Last active December 3, 2019 22:20
Component development
Component development
Needs evaluation
Will build -> To-do
Will use built-in platform component -> Uses built-in platform component
Is not applicable to platform -> Wont build for platform
Is not worth building -> Wont build for platform
Is already built correctly -> Merged
Is built but should be deprecated -> Deprecated
To-do
Start development -> In progress