Skip to content

Instantly share code, notes, and snippets.

View freshcutdevelopment's full-sized avatar

Sean Hunter freshcutdevelopment

View GitHub Profile
@freshcutdevelopment
freshcutdevelopment / SubstringSQL
Created November 10, 2014 20:51
Returns the substring of a given DB field starting from the last index of the given CHAR input
REVERSE(SUBSTRING(REVERSE([FIELD_NAME]), 0, CHARINDEX('CHAR', REVERSE([FIELD_NAME]))))
@freshcutdevelopment
freshcutdevelopment / SplitByLineCount
Created November 11, 2014 01:40
PowerShell one liner to split by line count
$i=0; Get-Content .\filePaths.txt -ReadCount 500 | %{$i++; $_ | Out-File out_$i.txt}
@freshcutdevelopment
freshcutdevelopment / Zip and Upload
Last active August 29, 2015 14:09
Creates a ZIP file with a unique name and uploads to a given FTP site
function ZipAndUpload([string]$ftpUrl, [string]$ftpUsername, [string]$ftpPassword, [string]$inputPath, [string]$filterExpression) {
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($ftpUsername,$ftpPassword)
$inputPath = Resolve-Path $inputPath
$file = [System.Io.File]::GetAttributes($inputPath)
$uniqueFormatPart = Get-Date -format yyyyMMddHHmmssfff
@freshcutdevelopment
freshcutdevelopment / GetFilePathRoot
Created May 9, 2015 09:22
Get file path root (excluding file name) with Vbscript
Function GetFilePath(FullPath)
Dim filePath, pathArray
pathArray = Split(FullPath, "\")
pathArray(UBound(pathArray)) = ""
filePath = Join(pathArray, "\")
open System
//take sale amount and tip %
//compute the tip amount
//print out both the tip and the total amount of the bill
let tipAmount saleAmount tipPercentage = tipPercentage/100.00 * saleAmount
let totalAmount saleAmount tipPercentage = (tipAmount saleAmount tipPercentage) + saleAmount
open System
type quote = {message :string; actor: string;}
[<EntryPoint>]
let main argv =
let quotes = [{message="shaken not stirred"; actor="sean connery"};
{message="i'll be back";actor="terminator"}]
open System
type story = {verb:string;noun:string;adjective:string;adverb:string}
let getResponse choice =
match choice with
| "yes" -> "That's hilarious. \n"
| "no" -> "That sucks. \n"
| _ -> "I don't even know how to respond to that. \n"
@freshcutdevelopment
freshcutdevelopment / app.html
Last active October 22, 2015 18:45
Aurelia - Getting Started
<!-- app/app.html -->
<template>
<h1>${status}</h1>
</template>
var gulp = require('gulp');
var browserSync = require('browser-sync');
var nodemon = require('gulp-nodemon');
gulp.task('browser-sync', ['nodemon'], function() {
browserSync.init(null, {
proxy: "http://localhost:5001",
files: ["app/**/*.*"],
browser: "google chrome",
port: 7001,
'use strict';
var express = require('express');
var app = express();
app.use(express.static('app'));
app.get('/', function(req, res) {
res.sendfile('./app/test.html');
});