Skip to content

Instantly share code, notes, and snippets.


Luke Duncan lukewduncan

View GitHub Profile
lukewduncan / add_keywords_to_profile.rb
Created June 11, 2017 02:29
Method to scan through PDF looking for keywords
View add_keywords_to_profile.rb
def add_keywords_to_profile(user)
io = open(user.resume_pdf.to_s)
reader =
reader.pages.each do |page|
string = page.text
KeywordHelper.keywords.each do |word|
if string.downcase.include?(word.downcase)
View eight.sql
SELECT, case when PAYMENTS.amount > 0 then 'true' else 'false' end AS have_paid,
FROM students WHERE MONTH(PAYMENTS.created_at) = 2
lukewduncan / main.js
Created January 27, 2017 03:06
Client Side Lambda Submission
View main.js
function subscribeToList(email) {
var params = {
AccountId: "xxxxxxxxxxx", // your AWS user account ID
RoleArn: "arn:aws:iam::xxxxxxxxxxx:role/Cognito_mailchimpCognitoUnauth_Role", // your Cognito unauth role (it wil look something like this)
IdentityPoolId: "us-east-1:xxxxxxxxxxxxxxxxx" // the identity pool id found in Cognito
// set the Amazon Cognito region
AWS.config.region = 'us-east-1';
// initialize the Credentials object with our parameters
lukewduncan / awscognito.js
Created January 27, 2017 03:02
Cognito Gist
View awscognito.js
* Copyright 2014,
* Inc. or its affiliates. All Rights Reserved.
* Licensed under the Amazon Software License (the "License").
* You may not use this file except in compliance with the
* License. A copy of the License is located at
lukewduncan / .env
Created January 27, 2017 01:15
AWS Lambda function for Mailchimp list subscription
View .env
lukewduncan / audio-player.html
Last active October 22, 2022 05:57
Audio Player
View audio-player.html
<div class="audio-player">
<div id="play-btn"></div>
<div class="audio-wrapper" id="player-container" href="javascript:;">
<audio id="player" ontimeupdate="initProgressBar()">
<source src="" type="audio/mp3">
<div class="player-controls scrubber">
<p>Oslo <small>by</small> Holy Esque</p>
<span id="seek-obj-container">
lukewduncan / Codeship Webhook URL
Last active May 30, 2016 16:29
Contentful, Codeship and Middleman code snippets for Article
View Codeship Webhook URL
lukewduncan / rot.rb
Created March 2, 2016 16:09
Technical Question
View rot.rb
def rotx(x, string, encrypt=true)
alphabet = Array("A".."Z") + Array("a".."z")
results = []
if encrypt == true
key_encrypt_true = Hash[]
string.chars.each do |i|
if ('a'..'z').include? i
results << key_encrypt_true.fetch(i).downcase
elsif ('A'..'Z').include? i