Skip to content

Instantly share code, notes, and snippets.

@greghaskins
greghaskins / Raffle script
Last active May 1, 2019 13:54
raffle.py: Randomly choose N unique entries from a list
We couldn’t find that file to show.

Keybase proof

I hereby claim:

  • I am greghaskins on github.
  • I am greghaskins (https://keybase.io/greghaskins) on keybase.
  • I have a public key whose fingerprint is 4329 89C3 6CDF 6718 BC11 ECA5 AA62 945D 5436 43DD

To claim this, I am signing this object:

You can trigger a GitHub Pages (Jekyll) rebuild with a single API call. This is pretty useful for auto-publishing blog posts from a bot like Zapier in conjunction with future: false in your Jekyll config.yml. Just future-date your posts, and they'll go live when that date rolls around. I use a version of this setup for my blog at greghaskins.com.

Setup

  1. Create a GitHub personal access token and save it somewhere. It needs to have the repo access scope (at least).

  2. Create a file at the root of your repo (e.g. .publish) with some dummy content.

    $ echo ".publish" > .publish
@greghaskins
greghaskins / fizzbuzz.R
Last active August 29, 2015 14:01
FizzBuzz kata written as an R function. Logic implemented with array subsetting instead of loops.
fizzbuzz <- function(){
input <- seq(1, 100)
result <- input
result[input %% 3 == 0] <- "Fizz"
result[input %% 5 == 0] <- "Buzz"
result[input %% 15 == 0] <- "FizzBuzz"
result
}
fizzbuzz()
@greghaskins
greghaskins / ruby_quick_intro.rb
Last active August 29, 2015 14:01
Quick reference for getting started with Ruby. Useful for people doing katas, etc. with some programming knowledge but no Ruby experience.
# These are some useful tips for programming in Ruby
# (Things in ALL_CAPS will be written by you)
# Comments begin with a "#" like this
# A test method
def test_SOMETHING
assert_equal EXPECTED_VALUE, ACTUAL_VALUE
end