Skip to content

Instantly share code, notes, and snippets.

View kenhowardpdx's full-sized avatar

Ken Howard kenhowardpdx

View GitHub Profile
@kenhowardpdx
kenhowardpdx / Image Group
Created February 18, 2014 00:47
CSG - Image Group
<style type="text/css">
.grid {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;.
content:"";
display:table;
clear:both;
margin: 0;
@kenhowardpdx
kenhowardpdx / README.md
Created July 8, 2014 19:34
Rewrite URL in Node with Express

I struggled to find the answer so I hope this helps someone else. This discussion on Google Groups helped point me in the right direction.

I have a website hosted on Microsoft Azure. Each website you create is assigned a subdomain to azurewebsites.net to which Google and Bing can and do index. My website is using a custom domain that I would prefer to use instead of the azurewebsites.net domain. To do this I needed to block Google and Bing from indexing my site on that domain.

I added the following code to my app.js file. INSERT BEFORE YOU CALL express.static.

/**************
 * Robots.txt redirect
 **************/
app.use(function(req, res, next){
@kenhowardpdx
kenhowardpdx / README.md
Last active August 29, 2015 14:05
Rake File using rsync and remote_task to deploy project and db

test

@kenhowardpdx
kenhowardpdx / printer.directive.js
Last active August 29, 2015 14:15
Printer Friendly Angular Directive
(function () {
'use strict';
angular.module('printerFriendly', [])
.directive('formControl', PrinterFriendly);
PrinterFriendly.$inject = ['$compile'];
function PrinterFriendly($compile) {
return {
@kenhowardpdx
kenhowardpdx / chutzpah.json
Created May 8, 2015 18:47
Chutzpah/Jasmine/TypeScript
{
"Framework": "jasmine",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ],
"Executable": "compile.bat",
"SourceDirectory": ".",
"OutDirectory": "./js"
},
@kenhowardpdx
kenhowardpdx / types.d.ts
Last active August 29, 2015 14:22
Data Model
declare module "userinterfaces" {
import Sequelize = require("sequelize");
module userinterfaces {
interface IUserSchema {
username: { type: Sequelize.DataTypeString, unique: Boolean, allowNull: Boolean } | String;
password: { type: Sequelize.DataTypeString, allowNull: Boolean } | String;
role: Sequelize.DataTypeString | String;
email: Sequelize.DataTypeString | String;
firstName: Sequelize.DataTypeString | String;
@kenhowardpdx
kenhowardpdx / toaster.d.ts
Created June 5, 2015 06:34
Toaster TypeScript Definition
// Type definitions for AngularJS-Toaster 0.4.14
// Project: https://github.com/jirikavi/AngularJS-Toaster
// Definitions by Ken Howard <https://github.com/kenhowardpdx>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module angular.toaster
{
interface IToasterService
{
pop: PopFunc;
@kenhowardpdx
kenhowardpdx / fit-vertical.directive.ts
Last active August 29, 2015 14:23
Angular Fit Vertical Directive (TypeScript)
module App.Directives
{
FitVerticalDirective.$inject = ['$window', '$timeout'];
export function FitVerticalDirective($window: ng.IWindowService, $timeout: ng.ITimeoutService)
{
var link: ng.IDirectiveLinkFn = function (scope: ng.IRootScopeService, element: ng.IAugmentedJQuery, attrs: ng.IAttributes)
{
var overflowY = getOverflowValue(attrs['verticalScroll']);
var overflowX = getOverflowValue(attrs['horizontalScroll']);
@kenhowardpdx
kenhowardpdx / loop_object.js
Created July 2, 2015 15:26
Loop through object
function loopObject(obj, prop) {
var matches = [];
for(var key in obj) {
if(obj.hasOwnProperty(key)) {
if(key === prop) {
if (typeof obj = 'string' || Array.isArray(obj)) {
matches.push(obj);
} else {
var objMatches = loopObject(obj[key], prop);
if(objMatches.length) {
@kenhowardpdx
kenhowardpdx / README.md
Last active August 29, 2015 14:24
Map Attribute Values

attributeValues originate on the data model and will be saved to the server. structure:

"site": {
  "details": {
    "attributeValues": [
        {
            "siteDetailsAttributeId": 0,
            "checkboxValue": false
 },