Skip to content

Instantly share code, notes, and snippets.

View marothstein's full-sized avatar

Matt Rothstein marothstein

View GitHub Profile
@marothstein
marothstein / Example.coffee
Created September 30, 2012 20:21
Example CoffeeScript gist to test highlighting
# Assignment:
number = 42
opposite = true
# Conditions:
number = -42 if opposite
# Functions:
square = (x) -> x * x
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>
@marothstein
marothstein / GetCardSwipe.js
Last active September 30, 2022 18:00
Basic implementation of methods needed to receive swiped credit card data with javascript.
/*
* Basic implementation of methods needed to receive swiped credit card data with javascript.
*
* NOTE: PCI compliance specifies that card data must never be stored in an unencrypted manner, and
* only certain pieces of card data can be stored persistently. Ensure that output logging is NOT
* stored persistently when using this file, as it contains console.log messages that are intended
* to educate the user, and these messages contain data that may compromise your PCI compliance posture.
*
* If you choose to use any of this code with real credit card data, it is your responsibility
* to remove all log statements, output, or other code that may serve to persist offending information.
@marothstein
marothstein / BoardingManager.js.coffee
Last active December 22, 2015 18:39
Boarding manager classes to work with the boarding APIs
Number::truncate = (decimal_places) ->
factor = Math.pow(10, decimal_places)
Number(Math.ceil(this * factor) / factor).toFixed decimal_places
String::sanitize = ->
@replace /[A-Za-z$-,]/g, ""
class Boarding.Helpers.BoardingManager extends Backbone.Events
token: null
permissions: null
@marothstein
marothstein / .git-completion.sh
Created October 7, 2013 17:24
Save to your home directory with the name '.git-completion.sh'
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@marothstein
marothstein / .git-flow-completion.bash
Created October 7, 2013 17:25
Save to your home directory with the name '.git-flow-completion.bash'
#!bash
#
# git-flow-completion
# ===================
#
# Bash completion support for [git-flow](http://github.com/nvie/gitflow)
#
# The contained completion routines provide support for completing:
#
# * git-flow init and version
@marothstein
marothstein / .git-prompt.sh
Created October 7, 2013 17:25
Save to your home directory with the name '.git-prompt.sh'
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see the current branch in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@marothstein
marothstein / login_screen.html
Created October 8, 2013 21:19
Login screen for the Cube web cct
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="VirtualTerminal.Login" %>
<!DOCTYPE html>
<html>
<head runat="server">
<link rel="stylesheet" type="text/css" href="https://raw.github.com/twbs/bootstrap/master/dist/css/bootstrap.min.css"/>
<style type="text/css">
article {
font-family: helvetica;
@marothstein
marothstein / engine.rb
Created January 6, 2014 22:14
SlidePay Gateway
module SpreeGateway
class Engine < Rails::Engine
engine_name 'spree_gateway'
config.autoload_paths += %W(#{config.root}/lib)
# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end
@marothstein
marothstein / AppDelegate.m
Last active August 29, 2015 14:01
login view controller situation - do I need a custom delegate?
// 1. App starts
// 2. If user is not logged in, rootViewController presents loginViewController (Code below)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
// Now check for authentication
[self checkIfLoggedIn];
...
return YES;
}