Skip to content

Instantly share code, notes, and snippets.

View sethkrasnianski's full-sized avatar
:shipit:
Building software.

Seth Krasnianski sethkrasnianski

:shipit:
Building software.
View GitHub Profile
/*
TITLE: Commissions Calculator
AUTHOR: Seth Krasnianski
PURPOSE: Calculate how much money is spent in commission to brokers and prepare a stock report to track commissions.
VARIABLE DICTIONARY
Variable Type Represents
first int Represents whether the program has been run before or not.
@sethkrasnianski
sethkrasnianski / madlibs.cpp
Created July 1, 2012 02:52
Programming Examples
/*
TITLE: Madlibs
AUTHOR: Seth Krasnianski
PURPOSE: Simple madlibs program, requires user input, then generates user created madlib.
*/
#include <iostream>
#include <string>
@sethkrasnianski
sethkrasnianski / validate.php
Created July 1, 2012 16:31
PHP Email Validation
<?php
/*
TITLE: PHP Validation
AUTHOR: Seth Krasnianski
PURPOSE: Validates that HTML form input are set. Two security additions to prevent direct access and invalid e-mails.
*/
// Prevents direct access
@sethkrasnianski
sethkrasnianski / statevalidate.php
Created July 1, 2012 17:28
PHP State Form Validation
<?php
/*
TITLE: PHP State Form Validation
AUTHOR: Seth Krasnianski
PURPOSE: Validates that HTML form input are set, and abide by rules of state expungement laws.
*/
$default = 'State'; // Default for state select input
@sethkrasnianski
sethkrasnianski / events.html
Created July 2, 2012 21:42
JavaScript Events
<!DOCTYPE html>
<!--
TITLE: JavaScript Events
AUTHOR: Seth Krasnianski
PURPOSE: Basic 'click' event and event handler in JavaScript.
-->
<html>
<head>
@sethkrasnianski
sethkrasnianski / gist:9560309
Last active August 29, 2015 13:57
Git Settings
## Git Shortcuts
alias gs="git status"
alias gd="git diff"
alias gb="git branch"
alias gcb "git checkout -b"
## Git detailed output
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
Function.prototype.debounce = function (threshold, execAsap) {
var func = this, timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
timeout = null;
;(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
:goat::goat::goat::goat::goat::goat::goat::goat:
:goat::goat::goat::goat::goat::goat::goat::goat:
:goat::goat::goat::goat::goat::goat::goat::goat:
:goat::goat: :goat::goat: :goat::goat:
:goat::goat: :goat: :goat::goat:
:goat::goat: :goat::goat:
:goat::goat: :goat: :goat: :goat::goat:
:goat::goat: :goat::goat: :goat::goat:
:goat::goat: :goat::goat: :goat::goat:
:goat::goat: :goat::goat: :goat::goat:
(deftest deleting-a-vendor
(let [admin-cs (sign-in 1)
research-cs (sign-in 0)]
(seed {:model "Vendor"})
(testing "deleting an existing vendor"
(are [code store] (= code (:status (delete "/api/vendors/1" {:cookie-store store})))
200 admin-cs
403 research-cs
404 admin-cs