Skip to content

Instantly share code, notes, and snippets.

View cgrusden's full-sized avatar

Corey G cgrusden

  • Ruby on Rails, iOS, Consulting
  • 100% Remote
View GitHub Profile
@cgrusden
cgrusden / calculate.js
Created October 28, 2014 14:46
5min. blah.
// http://www.zagat.com/best-restaurants/new-york
nums = $.map($('.scores > .score.cost'), function(val, i) { return($(val).text()); }); //Get all boxes w/scores
clean = $.map(nums, function(val, i) { return(/\w+/.exec(val)); }); //Get rid of $
var total=0; $.each(clean, function(val, i) { total += val }); console.log(total) //Calculate total
Total = $4,950
@cgrusden
cgrusden / trello.rb
Created October 30, 2014 05:50
Output trello json into Markdown format
require 'json'
json = JSON.parse(File.read("trello.json"))
json["lists"].each do |list|
puts "# #{list['name']}\n"
json["cards"].each do |card|
if card["idList"] == list["id"]
puts "## #{card['name']}\n"
json["checklists"].each do |chklist|
@cgrusden
cgrusden / parser.rb
Created November 13, 2014 23:32
Filter your Google Contacts QUICK
# Steps to clean up your google contacts:
# Read to know how to Export your contacts to Google CSV format: https://support.google.com/mail/answer/24911?hl=en
# Download those contacts to ~/contacts/google.csv
# Put this code into ~/contacts/parser.rb
# Change to that directory: $ cd ~/contacts/parser.rb
# Run the parser: $ ruby parser.rb
# Hit k <enter> to KEEP that contact in your new clean list
# Hit <enter> to PASS on keeping that contact in your new clean list
# Once all the way through, copy the header-line (the first line of google.csv) into your new clean_contacts.csv
# Go back to Google, import this into your contacts (it will not remove any of your contacts, it will create a new Contacts group
@cgrusden
cgrusden / parse_log_for_images.rb
Last active August 29, 2015 14:09
Parse log file for all image assets requested from the server
# Replace <file> with logfile from your server
grep -Eo 'GET\spath\S\"\/assets\/((\S+)[A-Za-z0-9]\-?\.(jpg|svg|gif|jpeg|png))\"' <file> | sort | uniq
@cgrusden
cgrusden / bashrc.txt
Last active August 29, 2015 14:09
Commandline commands that are awesome
$ find $(rvm gemdir) -name *.css | xargs grep html
ls -l app/controllers/*.rb | awk '{printf "Fix/Review %s\r\n", $9}'
@cgrusden
cgrusden / jeff_w.md
Created November 25, 2014 21:12
ferguson

On Ferguson: We all have biases. And the events of the last 24 hours have placed them on full display - in the news media, on the streets, and in social networks. It's interesting how very different people's definitions can be regarding basic principles like justice, morality, and the law. To some, the outcome means a criminal got what he had coming. To others, the grand jury's decision not to indict Officer Darren Wilson was another brick in the wall that keeps minorities from getting a fair shake. I think the truth lies somewhere in between. Last night I posted very briefly on the topic, implying that underneath all the fog, this specific situation is one where Michael Brown's choices led to a predictable outcome. This sparked a series of comments that surprised me with their emotion and racial overtones. I initially thought I would delete the post and comments, but I think I'll let them remain. The comments speak for themselves and I stand by mine. Some may have thought my post over-simplified the situatio

module SlackMocks
class Client
end
class User
def initialize(user)
end
class Channel
end
@cgrusden
cgrusden / gist:d4b987dd3c8073a37810
Created March 17, 2016 16:53
How to control a team in Github
Thanks for writing in! I'd recommend that they add an owner of your organization as an admin collaborator on the repository in their own organization. Then that owner can fork the repository into your org, and add whatever team from your org that needs access to it. Then you should be able to open a pull request back to the parent repo owned by your customer when you're ready to submit change proposals.
@cgrusden
cgrusden / setup github issues labels.sh
Last active July 21, 2016 22:12 — forked from rentzsch/setup github issues labels.sh
Shell script to set up a GitHub Project's Issues' Labels as described in <http://rentzsch.tumblr.com/post/252878320/my-lighthouse-ticket-settings-with-colors>.WARNING: script assumes a newish project that hasn't really used labels yet. It deletes all default labels, which means DATA LOSS if you've used them for anything.
USER=
PASS=
REPO=
ACCOUNT=sofetch
# Delete default labels
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACCOUNT/$REPO/labels/bug"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACCOUNT/$REPO/labels/duplicate"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACCOUNT/$REPO/labels/enhancement"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ACCOUNT/$REPO/labels/invalid"
@cgrusden
cgrusden / gist:3501e2a709c3be55fa88f9c29d1918f4
Created December 23, 2016 21:18
Part 2: Biz dev for tech companies
* Imported all contacts
* We’ll want to use the Keyboard so we can label these quickly
* Settings -> Keyboard Shortcut keys ON
* Create a group to work out of, that will keep track of who has not yet been labelled incase you want to go to lunch or something
* use “X” to select the current contact
* Think about the most generic label you can apply to this person, that will apply to many, many, many others
* Scan first page to see how many people you can group into the same group
* Use the keyboard shortcut keys to navigat the current list
* Hit the “J” key to go down
* And then once we find a Contact to group into the group we’re working with, hit “X” to select that Contact