Skip to content

Instantly share code, notes, and snippets.

View ninjapanzer's full-sized avatar
🌋
Back to the FOSS

Paul Scarrone ninjapanzer

🌋
Back to the FOSS
View GitHub Profile
@ninjapanzer
ninjapanzer / impact_testing_overview.js
Last active August 29, 2015 13:56
Impact Testing
describe('Plugins/SkinManager', function() {
it('init', function() {
var global={};
global.sm;
runs(function(){
testModule({ for:"skin-manager", requires:["plugins.skin-manager"] }).defines(function() {
@ninjapanzer
ninjapanzer / does_it_fit_as_carryon.rb
Created December 29, 2014 15:38
does it fit as carry on
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = ""
opts.on("-l", "--length v", "length") {|v| options[:length] = v}
opts.on("-w", "--width v", "width") {|v| options[:width] = v}
opts.on("-h", "--height v", "height") {|v| options[:height] = v}
opts.on("-sl", "--set-length v", "length") {|v| options[:setlength] = v}
opts.on("-sw", "--set-width v", "width") {|v| options[:setwidth] = v}
@ninjapanzer
ninjapanzer / preprocessor.js
Last active April 15, 2017 22:15
Jest Wepback Testing Preprocessor
'use strict';
// Adapted from https://github.com/ColCh/jest-webpack/blob/f8e02b7a51da48c55395392e61d9c03789e43911/preprocessor.js
// Packages these tests with deps with webpack https://github.com/ninjapanzer/Backbone-Flux-React-Webpack/tree/master/__tests__
var webpack = require('webpack');
var MemoryFileSystem = require('memory-fs');
var fs = new MemoryFileSystem();
@ninjapanzer
ninjapanzer / eventComp_test.js
Last active August 29, 2015 14:16
Error: Unable to parse child response data: 2 Tests
// __tests__/eventComp.js
jest.dontMock('../src/events/eventComp.coffee');
describe('eventComp', function() {
it('sees if the state is passed correctly to event', function() {
var EventComp = require('../src/events/eventComp');
var TestUtils = React.addons.TestUtils;
var event = {
get: function(thing){
{
"requestUrl": "/story/1/plot_points/",
"contentType": "application/json; charset=utf-8",
"statusCode": 200,
"data": [
{
"id": 1,
"title": "thing",
"description": "another",
"story_id": 1,
@ninjapanzer
ninjapanzer / maximize_xor.erl
Last active August 29, 2015 14:19
Hacker Rank Maximize XOR Erlang
-module(maximize_xor).
-export([main/0, test/0]).
-import(lists, [map/2, seq/2]).
main() ->
I = {inputs, [2,4]},
{inputs, [START|[STOP|_]]} = I,
EXPANDED_GROUP = lists:seq(START,STOP),
GROUPS = organize(EXPANDED_GROUP),
MAX = maximize_bxor(GROUPS, 0),
@ninjapanzer
ninjapanzer / count_repeate_characters.erl
Created April 22, 2015 02:13
Hacker Rank Finding matching character sequences
% Enter your code here. Read input from STDIN. Print output to STDOUT
% Your class should be named solution
-module(count_repeate_characters).
-export([main/0]).
main() ->
{inputs, STRINGS} = inputs(),
DELETES = find_deletes(STRINGS),
outputs(DELETES).
@ninjapanzer
ninjapanzer / halloween_party.py
Created April 23, 2015 00:47
Hacker Rank Halloween Party
# Enter your code here. Read input from STDIN. Print output to STDOUT\
from sys import stdin
# get the first line of the input and figure out how many cases there are to run
userinput = stdin.readline()
count = int(userinput)
# do the counting work
def count_pieces(cuts):
# divide the number of cuts in half and truncate to the nearest integer
half_cuts = int(cuts/2)
@ninjapanzer
ninjapanzer / the_workflow.md
Last active August 29, 2015 14:27
Basic workflow

The Workflow

  1. Check what branch you are on (git branch)
  2. Sync Remote via (git pull)
  3. Identify Feature for branch
  4. Create a branch for feature (git checkout -b <useful_branch_name>)
    • Branch name should be a reasonable unit of work that is worth 16hrs or so of work
  5. Do Work and Make a commit (git commit -m "<some message>")
  6. Sync with remote again via (git push) or (git gui)
  7. Open a PR for you new branch with a useful message in Github
  • use that PR for reference until the work is complete
@ninjapanzer
ninjapanzer / deploy.sh
Created August 29, 2015 03:10
Simple Shell Script to Deploy to gh-pages with bower dependencies
#!/bin/sh
SOURCE_BRANCH=`git rev-parse --abbrev-ref HEAD`
DEST_BRANCH=gh-pages
git checkout $DEST_BRANCH
# Make sure we actually made it to the destination branch
if [ `git rev-parse --abbrev-ref HEAD` != $DEST_BRANCH ]; then
echo "!!!! Something went wrong check the errors above and try again !!!!"