Skip to content

Instantly share code, notes, and snippets.

View jbubriski's full-sized avatar

John Bubriski jbubriski

View GitHub Profile
@jbubriski
jbubriski / readme.md
Last active August 29, 2015 13:55
PHP Development Options

For those coming from a Windows devleopment background...

Considerations

Versions

  • The stack is more fragmented than .NET land. Each piece of the stack has it's own versions
  • Portions are interchangable.

Options

@jbubriski
jbubriski / install.py
Created February 10, 2014 14:07
Install SublimeText 2 on Mac OSX by upgrading the script to supprt Python 3
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
@jbubriski
jbubriski / BizFormItems.tt
Last active August 29, 2015 13:56
T4 templates for auto-generating strongly typed classes for Kentico BizForms, and registering them with the CMS Type system.
<#@ template debug="True" hostspecific="True" language="C#" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System" #>
<#@ Assembly Name="System.Configuration" #>
<#@ assembly name="System.Core" #>
<#@ Assembly Name="System.Collections" #>
<#@ Assembly Name="System.Data" #>
<#@ Assembly Name="System.Linq" #>
<#@ Assembly Name="System.Xml" #>
<#@ Assembly Name="System.Xml.Linq" #>
@jbubriski
jbubriski / CustomTableItems.tt
Created February 14, 2014 16:01
T4 template for creating strongly typed classes for Kentico Custom Tables.
<#@ template debug="True" hostspecific="True" language="C#" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Configuration" #>
<#@ assembly name="System.Core" #>
<#@ Assembly Name="System.Collections" #>
<#@ Assembly Name="System.Data" #>
<#@ Assembly Name="System.Linq" #>
<#@ Assembly Name="System.Xml" #>
<#@ Assembly Name="System.Xml.Linq" #>
<#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #>
@jbubriski
jbubriski / Program.cs
Created March 7, 2014 14:53
Generic Constructor Example
using System;
namespace GenericConstructorTest
{
class Program
{
static void Main(string[] args)
{
// This doesn't compile
var myClass1 = new MyClass(5, 6);
@jbubriski
jbubriski / agenda.md
Last active August 29, 2015 13:57
WordPress Plugins 101 Agenda

Agenda

Intro

  • Dial people in
  • Does anyone have any issues with WAMP or WordPress running locally?
  • Any other important things to discuss?

Main Event

public string GetProductCategory()
{
var category = GetFirstCategory(CurrentDocument);
if (category != null)
{
var qsvalue = category.CategoryID;
return "?subject=" + qsvalue;
}
@jbubriski
jbubriski / AddItemToShoppingCart.cs
Created April 21, 2014 19:54
Kentico - Add an item to the shopping cart
public void AddItemToShoppingCart(int skuId, int quantity)
{
var skuInfo = SKUInfoProvider.GetSKUInfo(skuId);
// Create params
var cartItemParams = new ShoppingCartItemParameters(skuId, quantity);
// Ensure minimum allowed number of items is met
if (skuInfo.SKUMinItemsInOrder > quantity)
{
#!/usr/bin/env python
# saved to ~/bin/batcharge.py and from
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
@jbubriski
jbubriski / CustomSettings.tt
Last active August 29, 2015 14:02
T4 template for creating strongly typed properties for Kentico Custom Settings.
<#@ template debug="True" hostspecific="True" language="C#" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Configuration" #>
<#@ assembly name="System.Core" #>
<#@ Assembly Name="System.Collections" #>
<#@ Assembly Name="System.Data" #>
<#@ Assembly Name="System.Linq" #>
<#@ Assembly Name="System.Xml" #>
<#@ Assembly Name="System.Xml.Linq" #>
<#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #>