Skip to content

Instantly share code, notes, and snippets.

View dladowitz's full-sized avatar

David Ladowitz dladowitz

View GitHub Profile
@dladowitz
dladowitz / config.fish
Created October 7, 2016 07:32
Sourcing shell things for Fish Shell
#Primary config file for Fish Shell
# replace things because fish are picky
#sighhhh... replaces eval "$(rbenv init -)" with eval "rbenv init -" > /dev/null 2>&1
echo "Fishifying evals...."
cat ~/.shared_evals | sed -e 's/"$(/\\"/g' | sed -e 's/)"/\\" > \\/dev\\/null 2>\\&1/g' > ~/.config/fish/.fishified_shell_setup
echo "Getting ENV vars...."
cat ~/.shared_env >> ~/.config/fish/.fishified_shell_setup
@dladowitz
dladowitz / .gitconfig
Created October 6, 2016 16:33
git config file
[user]
name = David Ladowitz
email = david@ladowitz.com
[core]
quotepath = false
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore_global
editor = subl -n -w
[color]
ui = true
class String
def reverse_sentance
new_sentance = self
new_sentance = new_sentance.gsub(".", "")
new_sentance = new_sentance.split(" ")
new_sentance = new_sentance.reverse
new_sentance = new_sentance.join(" ")
new_sentance << "."
def numberOfPairs(a, k)
matching_pairs = [], outer_index = 0
while outer_index < a.length
inner_index = outer_index + 1
while inner_index < a.length
if a[outer_index] + a[inner_index] == k
matching_pairs = add_pair_to_array(matching_pairs, [a[outer_index], a[inner_index]])
end
This file has been truncated, but you can view the full file.
<body ng-style="{'overflow': main.overflowView ? 'auto' : 'hidden'}" style="overflow: hidden;" class="">
<!-- ngIf: !main.isLoaded && !main.overflowView && ('false' != 'true') -->
<!-- uiView: undefined --><ui-view name="miscView" class="ng-scope"></ui-view>
<div mobile-snap="" class="height_hundred" ng-show="main.isLoaded &amp;&amp; !main.overflowView">
<!-- ngIf: main.isSmallScreen -->
<snap-content snap-opt-disable="'right'" class="snap-content" style="">
<div class="row mobile-zero-margins">
<!-- uiView: undefined --><ui-view class="hidden-xs col-sm-1 ng-scope" style="width:60px" name="sidebarLeft" ng-hide="main.galleryView"><!-- ngIf: !main.isSmallScreen --><div ng-if="!main.isSmallScreen" class="ng-scope">
<div class="menu menu__border munu--fixed">
def check_admin_devices
count = 0
AdminDevice.limit.all.each do |admin_device|
device = Device.find(admin_device.id)
unless device.last_run_time_tester
puts "'last_run_time_tester' was false: #{admin_device.description}"
count += 1
end
end
@dladowitz
dladowitz / timer.rb
Created October 26, 2012 00:10
Testing timers using Benchmark vs start/end/ diffing
require 'benchmark'
def janky(length)
start_time = Time.now
(1..length).each { |num| num }
time = Time.now - start_time
time
end
def benchmarked(length)
@dladowitz
dladowitz / new.html.erb
Created August 5, 2012 00:56
Steps for Me Stripe file
<form action="/cards" method="post" id="payment-form">
<div class="form-row">
<script type="text/javascript" src="https://js.stripe.com/v1/">
<script type="text/javascript">
// this identifies your website in the createToken call below
$(document).ready(function(){
Stripe.setPublishableKey('pk_07T3vzpNsDZ1R1f6EXJUiQKC0u0qK');
});
@dladowitz
dladowitz / routes.rb
Created July 19, 2012 22:58
Non Rest Routes
RouterTester::Application.routes.draw do
get "managers/index"
get "managers/show"
get "managers/new"
get "managers/create"
get "managers/update"
@dladowitz
dladowitz / cust_router.rb
Created July 19, 2012 21:53
Custom Routes
RouterTester::Application.routes.draw do
resources :companies do
member do
put 'location'
end
end
resources :managers do