Skip to content

Instantly share code, notes, and snippets.

View egardner's full-sized avatar

Eric Gardner egardner

View GitHub Profile
@egardner
egardner / simple_scraper.rb
Last active August 29, 2015 14:15
Simple ruby web scraper with Nokogiri. Designed for use with the pages in the Getty virtual library website.
require 'nokogiri'
require 'open-uri'
require 'json'
class Book
attr_accessor :isbn
attr_accessor :title
attr_accessor :author
attr_accessor :keywords
attr_accessor :type
@egardner
egardner / main.js
Created January 6, 2015 22:24
Data-driven Slide-out Menu for Jekyll
---
layout: null
library: jquery-2.1.3.min.js
---
// If using a JS framework, include it here
{% include_relative _lib/{{page.library}} %}
// Application code goes here
$(document).ready(function(){
$('.js-menu-trigger').on('click touchstart', function(e){
@egardner
egardner / masonry-grid.scss
Last active November 29, 2016 12:49
CSS-only masonry grid layout
// Originally adapted from: http://sickdesigner.com/masonry-css-getting-awesome-with-css3/
#grid {
-moz-column-count: 3;
-moz-column-gap: 10px;
-webkit-column-count: 3;
-webkit-column-gap: 10px;
column-count: 3;
column-gap: 10px;
@egardner
egardner / keybase.md
Last active August 29, 2015 14:07
Keybase proof

Keybase proof

I hereby claim:

  • I am egardner on github.
  • I am egardner (https://keybase.io/egardner) on keybase.
  • I have a public key whose fingerprint is 66DB 5FF3 D927 7B36 FD31 D40F C088 E2FA 4635 3D27

To claim this, I am signing this object:

@egardner
egardner / regex.rb
Created August 28, 2014 14:58
Example regex to separate out sentences in a string
# Regex code to separate sentences out of strings
/(\S.+?[.!?:])(?=\s+|$)/
@egardner
egardner / mash_app.rb
Last active August 29, 2015 14:05
Sinatra mashable client router code
require "sinatra"
require "httparty"
require "time"
url = "http://mashable.com/stories.json"
mash_stories = HTTParty.get(url) # returns a hash
get '/' do
# If url is root: ----------------------------------------------------------------------------- #