Skip to content

Instantly share code, notes, and snippets.

View crherlihy's full-sized avatar

Christine Herlihy crherlihy

View GitHub Profile
@btfak
btfak / useHexo.md
Created May 26, 2016 09:41
How to use Hexo and deploy to GitHub Pages
@moveo123
moveo123 / Exhibit
Last active August 29, 2015 14:19
Mewseum Quest Estimote Analytics integration code
/*
This is the code to fetch nearest beacon and pass to DescriptionViewController.
*/
- (void)beaconManager:(id)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region{
if(beacons.count!=0){
self.beacon = [beacons firstObject];
NSLog(@"UUID - %@",self.beacon.proximityUUID.UUIDString);
NSLog(@"%@",[NSString stringWithFormat:@"Major: %@, Minor: %@", self.beacon.major, self.beacon.minor]);
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@benmarwick
benmarwick / PDF-2-text-or-CSV.r
Last active July 18, 2022 03:48
Convert PDFs to text files or CSV files (DfR format) with R
# Here are a few methods for getting text from PDF files. Do read through
# the instructions carefully! NOte that this code is written for Windows 7,
# slight adjustments may be needed for other OSs
# Tell R what folder contains your 1000s of PDFs
dest <- "G:/somehere/with/many/PDFs"
# make a vector of PDF file names
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE)
@KristineNessa
KristineNessa / gist:5499031
Last active June 23, 2023 15:54
The Java code below is an example of how we can validate the "check digit" of a UPC (Universal Product Code) 12 digit code. There are multiple ways the Luhn algorithm can be implemented using code. This Gist is designed to get the thought process rolling and to see how others would modify the code to be more efficient for the same 12 digit UPC "…
/**
* Validate a UPC code by calculating for the check digit number.
*/
import java.util.Scanner;
public class ValidateUPCCode {
// Main function
public static void main(String[] args) {
@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@rogerallen
rogerallen / us_state_abbrev.py
Last active April 19, 2024 14:04
A Python Dictionary to translate US States to Two letter codes
# United States of America Python Dictionary to translate States,
# Districts & Territories to Two-Letter codes and vice versa.
#
# Canonical URL: https://gist.github.com/rogerallen/1583593
#
# Dedicated to the public domain. To the extent possible under law,
# Roger Allen has waived all copyright and related or neighboring
# rights to this code. Data originally from Wikipedia at the url:
# https://en.wikipedia.org/wiki/ISO_3166-2:US
#