Skip to content

Instantly share code, notes, and snippets.

View jstott's full-sized avatar

Jim Stott jstott

View GitHub Profile
define(['durandal/system', './transitionHelper'], function(system, helper) {
var settings = {
inAnimation: 'fadeInLeftBig',
outAnimation: 'fadeOutRight'
},
fadeIn = function(context) {
system.extend(context, settings);
return helper.create(context);
};
@jstott
jstott / node-install.sh
Created September 13, 2013 15:26
Install script for node (Ubuntu bash shell)
#!/bin/bash
# Install nodejs.
#
# Usage: sudo ./node-install.sh
#
# By Jim Stott
#
# Tested on Ubuntu 13.04
# Created at: 2013-09-09
@jstott
jstott / redis-install-full.sh
Last active December 23, 2015 00:18
redis.io install and initial setup (Ubuntu 13.04 bash shell) for upstart
#!/bin/bash
# Install redis and run via upstart on Ubuntu.
#
# Get Script:
# wget -O redis-install-full.sh https://gist.github.com/jstott/6552270/raw
# chmod +x redis-install-full.sh
#
# Usage: sudo ./redis-install-full.sh
#
@jstott
jstott / main.js
Last active June 9, 2020 14:55
Durandal plugin (durandal spa framework) for raygun.io (error exception tracking) This assumes you've loaded the raygun.js script in your main page or elsewhere: see https://github.com/MindscapeHQ/raygun4js All system.error() and unhanded exceptions will be recorded via Raygun.
// fragment from main.js
// specify which plugins to install and their configuration v2.0
// assumes raygun4js is loaded
app.configurePlugins({
router: true,
rayGun: {
enable: true, // !system.debug,
errorOption: { systemError: true, suppress: true },
apiKey: 'your-apikey-here',
version: 'x.y.z',
@jstott
jstott / analytics.js
Created November 22, 2013 18:10
Durandal plugin to support google analytics. Usage sample: .trackPage ( url, page, title ) .trackEvent ( category, action, label, Value ) .userTimings ( timingCategory, timingVar, timingValue, timingLabel )
/**
* Integrates Google Analytics within Durandal, optionally (re)mapping system.error.
* @module analytics
* @requires system
* @example
// sample configuration from main.js
app.configurePlugins({
... other plugins ...
analytics: {
enable: true, // !system.isDebugging,
@jstott
jstott / phantomjs-install.sh
Last active December 30, 2015 23:49
Install phantomjs script
#!/bin/bash
# Install phantomjs.
#
# Get file:
# wget https://gist.github.com/jstott/7903681/raw/fe0c616957d63f61fc06e45d5cacc66880cf4190/phantomjs-install.sh
# Change Permissions to execute
# chmod +x phantomjs-install.sh
# Usage: sudo ./phantomjs-install.sh
#
@jstott
jstott / New machine bootstrap
Created December 19, 2013 17:44
New (windows) machine software install script - few things removed/added from the original Source was liberally lifted from Rick Strahl's blog post at http://weblog.west-wind.com/posts/2013/Dec/19/Dell-XPS-15-review
REM on one line
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex
((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
&& SET PATH=%PATH%;%systemdrive%\chocolatey\bin
REM Apps
cinst GoogleChrome
cinst Firefox
cinst imgburn
@jstott
jstott / OctoTentical
Last active August 29, 2015 14:18
Boxstarter target for Octo-Tentacle target servers - START http://boxstarter.org/package/nr/url?
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
cinst notepadplusplus
cinst googlechrome
cinst dotnet4.5.2
cinst octopusdeploy.tentacle
cinst git.install
cinst 7zip.install
cinst 7zip.commandline
@jstott
jstott / paginated.js
Created January 14, 2017 16:22
lodash paginated items
function getPaginatedItems(items, page, pageSize) {
var pg = page || 1,
pgSize = pageSize || 100,
offset = (pg - 1) * pgSize,
pagedItems = _.drop(items, offset).slice(0, pgSize);
return {
page: pg,
pageSize: pgSize,
total: items.length,
total_pages: Math.ceil(items.length / pgSize),
@jstott
jstott / indexFragmentation.sql
Created February 10, 2017 18:41
MS SQL check the index fragmentation
DECLARE @DatabaseID int
SET @DatabaseID = DB_ID()
SELECT DB_NAME(@DatabaseID) AS DatabaseName,
schemas.[name] AS SchemaName,
objects.[name] AS ObjectName,
indexes.[name] AS IndexName,
objects.type_desc AS ObjectType,
indexes.type_desc AS IndexType,