Skip to content

Instantly share code, notes, and snippets.

View mrowles's full-sized avatar
🎣
Gone fishing

Matthew Rowles mrowles

🎣
Gone fishing
View GitHub Profile
@mrowles
mrowles / gallery.spec.js
Last active October 13, 2017 05:02
BDD Spec Example
@mrowles
mrowles / _spacers.scss
Last active August 22, 2016 11:11
Creates spacer classes in SCSS for use throughout HTML
/*
Dynamic spacing classes
Spacers that grow and shrink based off ratios between the breakpoints
Margins:
<div class="m-top-sm m-right-md m-bottom-sm m-left-md">...</div>
<div class="m-sm">...</div>
Padding:
<div class="p-top-sm p-right-md p-bottop-sm p-left-md">...</div>
@mrowles
mrowles / _colors.scss
Last active July 19, 2016 10:15
Nice way to manage colors
/* Color palette */
$colors: (
white-1: #fff,
black-1: #000,
grey-1: #eee,
grey-2: #ccc,
blue-1: #69d2e7,
blue-2: #a7dbd8,
red-1: #e82d27,
red-2: #d82023,
@mrowles
mrowles / GetLongestFirstWordInColumn.sql
Created December 9, 2015 23:58
Get longest first word in column
SELECT SUBSTRING_INDEX( `field_name` , ' ', 1 ) AS `field_name_first_word`
FROM `table_name`
ORDER BY LENGTH(`field_name_first_word`) desc;
@mrowles
mrowles / atoi.swift
Last active August 29, 2015 14:18
ATOI in Swift
/*
* Converts ASCII string to an Int where plausible
* @param {String} str the string passed to atoi
* return {Int?} the converted integer value
*/
func atoi(str: String) -> Int? {
// Trim trailing whitespace
var newStr:String = str.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
@mrowles
mrowles / ListFilesInDirectory.bas
Created May 13, 2013 05:08
Microsoft Excel: List all files and properties of a specific criteria in a particular directory inside a worksheet called "Files"
'ListFilesInDirectory
'Lists all files of specific criteria (e.g., '*.pdf') in certain folder
Sub ListFilesInDirectory()
On Error GoTo ErrHandler
Dim sFilename As String, sPath As String
Dim fsFile, fsFileProps As Object
Dim sProceed As Integer
Dim i As Long
@mrowles
mrowles / parseXML.js
Last active December 16, 2015 07:49
jQuery/JavaScript: Cycles an XML file on successful load via ajax and parses contents into HTML. In this example, we are using an Employee xml file with basic information parsing
/* Tested with jquery-1.7.2.min.js */
$(window).load(function () {
"use strict";
/* Cycles XML file on successful load via ajax and parses contents into HTML */
function parseXML(xml) {
/* Variable declaration */
var outHTML = "", employee, sId, sFirstname, sSurname, sAddress;
@mrowles
mrowles / ExcelWorksheetExists.bas
Last active December 16, 2015 07:39
Microsoft Excel: This function checks if a Worksheet exists by accepting a Worksheet name as a parameter and looping through available worksheets. It will return false if the name is not found, otherwise it will return true if a Worksheet with the passed parameter exists. It is case-insensitive.
Function WorksheetExists(wsName As String) As Boolean
Dim ws As Worksheet
Dim found As Boolean
found = False
wsName = UCase(wsName)
For Each ws In ThisWorkbook.Sheets
If UCase(ws.Name) = wsName Then
@mrowles
mrowles / RefreshODBCLinks.bas
Last active December 15, 2015 06:39
Microsoft Access: The RefreshODBCLinks will refresh your ODBC connections each time you wish to make a query/connection to the backend database. In this example, the RefreshODBC function is called when opening the Access Database. It can also be called before using queries in your code to ensure the data is always correct and up to date and the …
@mrowles
mrowles / AccessErrorHandler.bas
Last active October 13, 2015 22:08
Microsoft Access: Central Error Handler
'Global Error Varibles
Public bDisplayError As Boolean
Public sProcName, sDetails As String
Public iErrorCount As Integer
Public Function bCentralErrorHandler(ByVal sModule$, ByVal sSub$, ByVal sDetails$) As Boolean
'Make sure there is no errors in the Error Handling system
On Error Resume Next