Skip to content

Instantly share code, notes, and snippets.

View shadda's full-sized avatar
💭
Freaking out in a moon-age daydream, oh yeah.

Matt Wilson shadda

💭
Freaking out in a moon-age daydream, oh yeah.
View GitHub Profile
@shadda
shadda / Dockerfile
Created October 1, 2015 20:41 — forked from kvncrw/Dockerfile
PHP5.6 latest FPM with Laravel 5.* deps and some stupid pecl stuff
FROM php:5.6-fpm
# compile + install xdebug
RUN curl -SL "http://xdebug.org/files/xdebug-2.3.3.tgz" -o xdebug.tar.xz \
&& mkdir -p /usr/src/xdebug \
&& tar -xof xdebug.tar.xz -C /usr/src/xdebug --strip-components=1 \
&& rm xdebug.tar.xz \
&& cd /usr/src/xdebug \
&& phpize \
&& ./configure \
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$response = [
'success' => false,
'lowest_price' => null,
'volume' => null,
'median_price' => null
];
<?php
#########################
#TEN SECOND PDO TUTORIAL#
#########################
//Connect, providing any parameters your connection requires, along with username and password
$db = new PDO('mysql:host=localhost;db=ashleymadison.com;charset=uft8', 'user', 'pass');
//Set the error mode so that it throws exceptions rather outputting an error
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@shadda
shadda / foo.php
Last active September 30, 2015 23:41
<?php
function coalesce(&$value, $ifnull=null)
{
if(!isset($value))
{
return $ifnull;
}
return $value;
}
/* Tomorrow Night Eighties Theme */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
.tomorrow-comment, pre .comment, pre .title {
color: #999999;
}
.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
color: #f2777a;
}
DataManager.getSysDeviceCompatibility { (data) -> Void in
var parseError: NSError?
let parsedObject: AnyObject? = NSJSONSerialization.JSONObjectWithData(data,
options: NSJSONReadingOptions.AllowFragments,
error:&parseError)
//2
if let devices = parsedObject as? NSDictionary {
if let feed = devices["feed"] as? NSDictionary {
if let deviceEntry = feed["entry"] as? NSArray {
@font-face {
font-family: mensch;
src: url('../fonts/mensch-webfont.woff');
}
@font-face {
font-family: menlo;
src: url('../fonts/menlo-webfont.woff');
}
@font-face {
font-family: monaco;
<?php
$db = new PDO("mysql:dbname=mydb;host=localhost", $user, $password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
function get_row($parent_id)
{
global $db; //I would normally never do this, but its simpler than explaining the concept of a singleton
$parent_id = (int) $parent_id; //Cast to int
{
"codeformatter_css_options":
{
"end_with_newline": true,
"indent_char": " ",
"indent_size": 4,
"indent_with_tabs": true,
"selector_separator_newline": true
},
"codeformatter_js_options":
{
"color_scheme": "Packages/User/Colorsublime/themes/Chelevra.tmTheme",
"font_face": "Menlo",
"font_size": 13,
"ignored_packages":
[
"Vintage"
],
"sidebar_small": true,
"tabs_small": true,