Skip to content

Instantly share code, notes, and snippets.

View AlphaGit's full-sized avatar

Alpha AlphaGit

View GitHub Profile
@AlphaGit
AlphaGit / 01 - Theme Testing Process.markdown
Created February 6, 2015 12:11
Theme testing process (from Wordpress Codex)

Theme Testing Process

from Theme Development (Wordpress Codex)

  • Fix PHP and WordPress errors. Add the following debug setting to your wp-config.php file to see deprecated function calls and other WordPress-related errors: define('WP_DEBUG', true);. See Deprecated Functions Hook for more information.
  • Check template files against Template File Checklist.
  • Do a run-through using the Theme Unit Test.
  • Validate HTML and CSS. See Validating a Website.
  • Check for JavaScript errors.
  • Test in all your target browsers. For example, IE7, IE8, IE9, Safari, Chrome, Opera, and Firefox.
  • Clean up any extraneous comments, debug settings, or TODO items.
@AlphaGit
AlphaGit / Gruntfile.js
Created August 8, 2015 05:30
Configuring Protractor to run
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
connect: {
server: {
options: {
hostname: 'localhost',
port: 9001,
base: '.'
@AlphaGit
AlphaGit / .travis.yml
Last active August 29, 2015 14:26
Configuring Protractor to run on Travis and SauceLabs
language: node_js
sudo: false
cache:
directories:
- node_modules
- bower_components
- $(npm config get prefix)/bin/grunt-cli
- $(npm config get prefix)/bin/bower
node_js:
- 0.10
@AlphaGit
AlphaGit / code.gs
Last active December 17, 2016 21:31
Google Script: automatically logging calendar times to JIRA
function logHoursForToday() {
setDatesToYesterday();
var options = readOptions();
logHours(options);
}
function setDatesToYesterday() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Setup");
// based on https://developers.google.com/adwords/scripts/docs/features/dates#creating_a_date_object_from_a_formatted_date_string
@AlphaGit
AlphaGit / sum.js
Created January 9, 2016 22:26
Knowledge management
function sum(value1, value2) {
return value1 + value2;
}
sum(2, 2); // 4
sum(0.2, 0.6); // 0.8
sum(0.2, 0.7); // 0.8999999999999999
@AlphaGit
AlphaGit / Consumer.cs
Last active March 20, 2016 23:45
Coupled Producer/Consumer classes
public class Consumer {
public void DoConsumption() {
var producer = new Producer();
var value = producer.DoProduction();
// do something with value
}
}
@AlphaGit
AlphaGit / Consumer.cs
Created March 20, 2016 23:44
Decoupled Producer/Consumer classes
public class Consumer {
private IProducer _producer;
// Constructor
public Consumer(IProducer producer) {
_producer = producer;
}
public void DoConsumption() {
var value = _producer.DoProduction();
@AlphaGit
AlphaGit / Consumer.cs
Created March 21, 2016 00:16
Decoupled Producer/Consumer, renovating instances
public class Consumer
{
private Type _producerClass;
public Consumer(Type producerClass)
{
if (!typeof (IProducer).IsAssignableFrom(producerClass))
throw new ArgumentException("producerClass must be a IProducer type");
_producerClass = producerClass;
@AlphaGit
AlphaGit / ConsumerTests.cs
Created March 21, 2016 00:32
Coupled consumer Fakes Aseembly tests
using ClassDependencyTest.Example.Coupled;
using ClassDependencyTest.Example.Coupled.Fakes;
using Microsoft.QualityTools.Testing.Fakes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ClassDependencyTestTests.Example.Coupled
{
[TestClass]
public class ConsumerTests
{
@AlphaGit
AlphaGit / MySingletonClass.cs
Created April 25, 2016 01:42
Typical Singleton Pattern
public class MySingletonClass {
private static MySingletonClass _instance;
// private constructor
private MySingletonClass() { }
// public accessor property that instantiates if needed
public static Instance => _instance ?? (_instance = new MySingletonClass());
}