Skip to content

Instantly share code, notes, and snippets.

View tlongren's full-sized avatar
🎯
Focusing

Tyler Longren tlongren

🎯
Focusing
View GitHub Profile
@tlongren
tlongren / checkAPI.php
Created June 19, 2013 18:18
Check if API url is online before proceeding with calls to said API
<?php
$checkapi = (@fsockopen("solus.fliphost.net", 443, $errno, $errstr, 0.4) ? "up" : "down");
echo $checkapi;
?>
@georgepsarakis
georgepsarakis / templater.php
Last active December 28, 2015 11:59
PHP Templating
<?php
class T {
protected $Context = array();
protected $Compiled = NULL;
public $Regex_Variable = '~\{\{\s+[a-z_0-9\|:\.]+\s+\}\}~imsu';
public $Separator_Filter = '|';
public $Separator_Directive = ':';
protected $HTML_Encoder = NULL;
protected $HTML_ENCODE = TRUE;
protected $VALUE_CACHE = array();
@phrasz
phrasz / PushALL.sh
Created November 27, 2013 06:21
This is the same as my PushALL.bat, but with Linux and Bash...
#!/bin/bash
clear
names_array=(`grep "remote \"" .git/config | awk '{print $2}' | tr -d "\"\|]"`)
branch="master"
echo -e " ____ __ ______ __ __"
echo -e " /\\ _ \\ /\\ \\ /\\ _ \\/\\ \\ /\\ \\"
echo -e " \\ \\ \\_\\ \\__ __ ___\\\\ \\ \\___ \\ \\ \\_\\ \\ \\ \\ \\ \\ \\"
echo -e " \\ \\ __/\\ \\/\\ \\ / __\\\\ \\ __ \\ \\ \\ __ \\ \\ \\ \\ \\ \\"
echo -e " \\ \\ \\/\\ \\ \\_\\ \\/\\__, \\\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\___ \\ \\ \\____"
<?php
define('PAPERTRAIL_PORT','123456');
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, 'logs.papertrailapp.com', PAPERTRAIL_PORT);
}
socket_close($sock);
}
@micahhausler
micahhausler / master.sh
Last active January 23, 2016 08:42
Docker Orca (0.4.0) Quickstart instructions
#!/bin/bash
#
# Requires docker-toolbox >= 1.9.0d
# https://github.com/docker/toolbox/releases
MACHINE_NAME="orcamaster"
docker-machine create -d virtualbox $MACHINE_NAME
eval $(docker-machine env $MACHINE_NAME)
@jlfwong
jlfwong / RequireJSsubprocess.md
Created September 29, 2013 19:24
Require JS Subprocess Rubber Ducky Log

Building the package! RequireJS plugin, I'm getting weird side effect problems.

Requiring a package first:

> require(["package!issues.js"]); null
null
Require Package: issues.js package_loader_plugin.js?bust=1379092758956:96
XHR finished loading: "http://localhost:1234/javascript-packages.json".

jquery.js?bust=1379092758956:8526

@BurlesonBrad
BurlesonBrad / gist:de5b1ca4644d2b58a10f
Created May 1, 2015 16:08
Full Potential of Schema and WooCommerce
<div itemscope itemtype="http://schema.org/Product">
<span itemprop="name">Kenmore White 17" Microwave</span>
<img src="kenmore-microwave-17in.jpg" alt='Kenmore 17" Microwave' />
<div itemprop="aggregateRating"
itemscope itemtype="http://schema.org/AggregateRating">
Rated <span itemprop="ratingValue">3.5</span>/5
based on <span itemprop="reviewCount">11</span> customer reviews
</div>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<!--price is 1000, a number, with locale-specific thousands separator
@tlongren
tlongren / config.json
Created July 20, 2015 01:58
sublime-text-3-user-config
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 2,
"caret_style": "phase",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
"font_face": "Source Code Pro",
"font_options":
@neokoenig
neokoenig / settings.cfm
Created November 23, 2016 10:20
CFWheels Bootstrap3 form defaults
<cfscript>
// BS3 form settings
set(functionName="startFormTag");
set(functionName="submitTag", class="btn btn-primary", value="Save Changes");
set(functionName="checkBox,checkBoxTag", labelPlacement="aroundRight", prependToLabel="<div class=""checkbox"">", appendToLabel="</div>", uncheckedValue="0");
set(functionName="radioButton,radioButtonTag", labelPlacement="aroundRight", prependToLabel="<div class=""radio"">", appendToLabel="</div>");
set(functionName="textField,textFieldTag,select,selectTag,passwordField,passwordFieldTag,textArea,textAreaTag,fileFieldTag,fileField",
class="form-control",
labelClass="control-label",
labelPlacement="before",
@coderofsalvation
coderofsalvation / Syslog.php
Last active December 19, 2017 14:20
static php class for syslog-style logging to local syslogdaemon (native php), remote syslog server, or papertrailapp
/*
* PLEASE DO NOT USE THIS CODE, BUT GO TO: https://github.com/coderofsalvation/syslog-flexible
*/
// local, remote and papertrail compatible syslogclass
class Syslog{
public static $hostname = false;
public static $port = 514;
public static $program = "[]";