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">
require 'json'
uri = URI.parse("https://api.admoda.com/v1/advertiser/stats/campaigns.csv?date=2015-03-11")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE # read into this
headers = {'Authorization' => 'Token a3446590e8920e90e857f20c3d24479c'}
response = http.get(uri.request_uri, headers)
p "----Response----"
class Person
attr_accessor :name, :age
def initialize
puts "name: #{name}"
puts "@name: #{@name}"
name = "David"
@name = "Tom"
require 'json'
require 'rest-client'
#get a big block of json
github_json = RestClient.get('https://api.github.com/users/rails/repos')
#format the json for ruby to read
ghub_json = JSON.load(github_json)
#loop over all the repos in the formatted json
@dladowitz
dladowitz / gist:9595604
Created March 17, 2014 08:11
First Pass at Payday class
require 'date'
require 'active_support/core_ext/integer/inflections'
class Payday
def self.get_next_payday(date)
payday = Payday.get_next_standard_payday(date)
payday = Payday.weekend_adjustment(payday)
"Payday will be " + payday.strftime("%a %b #{payday.day.ordinalize}")
@dladowitz
dladowitz / payday.rb
Created March 17, 2014 08:00
Given a date, this class is used to find the next payday being the 1st or the 15th. If the payday falls on a weekend or holiday the payday is adjusted to the business day. Note that you'll need to install the gems 'holidays' and 'active_support'. Not sure if this last on if available outside of rails
require 'date'
require 'active_support/core_ext/integer/inflections' # Used for printing date as human text
require 'holidays' # Gives access to holiays
class Payday
def initialize(query_date)
@query_date = query_date
@next_payday = 'unknown'
end