Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
@renoirb
renoirb / TimeHelper.php
Created March 17, 2014 00:25
PHP Time Helper
<?php
namespace Renoir\Util;
// Specific
use \DateTime;
use \DateInterval;
/**
* Time helper utility
@karminski
karminski / currying.php
Created March 17, 2014 11:23
currying.php
<?php
define("_", 0);
class Currying{
private $arg1;
public function __construct($arg1){
$this->func_a[0] = $arg1;
<?php
$local_file = 'assets/info_system/rss_feeds/feed.xml';
$result = file_get_contents($local_file);
$xml = simplexml_load_string($result);
$xml->registerXPathNamespace('yweather', 'http://xml.weather.yahoo.com/ns/rss/1.0');
$location = $xml->channel->xpath('yweather:location');
if(!empty($location)) {
@steveh
steveh / README.md
Last active August 29, 2015 14:00
PHP media query combiner

INSTALLATION

  1. Save script to e.g. /usr/local/bin/media-query-combiner
  2. chmod +x /usr/local/bin/media-query-combiner

USAGE

Reads from stdin and writes to stdout.

@torounit
torounit / Tweets.php
Last active August 29, 2015 14:01
Twitter APIで取得したTweets Objectをちょっと便利にするクラス。 Tweets (https://dev.twitter.com/docs/platform-objects/tweets)
<?php
Class Tweets extends ArrayObject {
public function __construct( Array $tweets ) {
foreach($tweets as $key => $tweet) {
$this->offsetSet($key, $this->createTweet($tweet));
}
}
@gowon
gowon / bytes.php
Created May 24, 2014 04:23
Simple Byte-size handling class
<?php
class Bytes
{
private $sizeInBytes;
private static $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
public function __construct($sizeInBytes)
{
$this->sizeInBytes = floatval($sizeInBytes);
<?php
/**
* Parser class content
* @author Vasinsky Igor
* @email igor.vasinsky@gmail.com
* @copyright 2013
*/
class Parser{
/**
<?php
/**
* getBrowser
*
* @param void
* @return string
*/
function getBrowser()
{
$browser = array(
<?php
function _scripturebooks() {
return array("Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy", "Joshua", "Judges", "Ruth", "1 Samuel", "2 Samuel", "1 Kings", "2 Kings", "1 Chronicles", "2 Chronicles", "Ezra", "Nehemiah", "Esther", "Job", "Psalm", "Proverbs", "Ecclesiastes", "Song of Solomon", "Isaiah", "Jeremiah", "Lamentations", "Ezekiel", "Daniel", "Hosea", "Joel", "Amos", "Obadiah", "Jonah", "Micah", "Nahum", "Habakkuk", "Zephaniah", "Haggai", "Zechariah", "Malachi", "Matthew", "Mark", "Luke", "John", "Acts", "Romans", "1 Corinthians", "2 Corinthians", "Galatians", "Ephesians", "Philippians", "Colossians", "1 Thessalonians", "2 Thessalonians", "1 Timothy", "2 Timothy", "Titus", "Philemon", "Hebrews", "James", "1 Peter", "2 Peter", "1 John", "2 John", "3 John", "Jude", "Revelation");
}
function scripturesort($a, $b) {
if ($a == $b) {return 0;}
$order=_scripturebooks();
#!/usr/bin/env python
"""
organize-photos.py - Organize an unstructured folder tree of photos and movie
files into a month-and-year folder structure.
Note: This is a minor rewrite of @cliss's extension [1,2] of @drdrang's
photo management scripts [3], and includes a tweak from @jamiepinkham [4,5].
The lists of raw [6] and video [7] file extensions were found elsewhere.