Skip to content

Instantly share code, notes, and snippets.

View lukewduncan's full-sized avatar
👶

Luke Duncan lukewduncan

👶
View GitHub Profile
@lukewduncan
lukewduncan / add_keywords_to_profile.rb
Created June 11, 2017 02:29
Method to scan through PDF looking for keywords
def add_keywords_to_profile(user)
io = open(user.resume_pdf.to_s)
reader = PDF::Reader.new(io)
reader.pages.each do |page|
string = page.text
KeywordHelper.keywords.each do |word|
if string.downcase.include?(word.downcase)
user.keywords.push(word)
user.save
end
SELECT STUDENTS.name, case when PAYMENTS.amount > 0 then 'true' else 'false' end AS have_paid,
FROM students WHERE MONTH(PAYMENTS.created_at) = 2
@lukewduncan
lukewduncan / main.js
Created January 27, 2017 03:06
Client Side Lambda Submission
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
lukewduncan / awscognito.js
Created January 27, 2017 03:02
Cognito Gist
/**
* Copyright 2014 Amazon.com,
* 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
*
* http://aws.amazon.com/asl/
*
@lukewduncan
lukewduncan / .env
Created January 27, 2017 01:15
AWS Lambda function for Mailchimp list subscription
API_KEY='xxxxxxxxxxxxxxxxxxx-us1'
LIST_ID=12033101ax
@lukewduncan
lukewduncan / audio-player.html
Last active October 22, 2022 05:57
Audio Player
<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="https://dl-web.dropbox.com/get/Oslo.mp3?_subject_uid=199049471&w=AABuDNt9BDJnaZOelVFws9FXTufkXCvAPS5SYpy_gRZ2GQ&duc_id=dropbox_duc_id" type="audio/mp3">
</audio>
</div>
<div class="player-controls scrubber">
<p>Oslo <small>by</small> Holy Esque</p>
<span id="seek-obj-container">
@lukewduncan
lukewduncan / Codeship Webhook URL
Last active May 30, 2016 16:29
Contentful, Codeship and Middleman code snippets for Article
https://codeship.com/api/v1/builds/#GRAB_BUILD_NUMBER_AND_PLACE_HERE/restart.json?api_key=YOUR_CODESHIP_API_KEY
@lukewduncan
lukewduncan / rot.rb
Created March 2, 2016 16:09
Technical Question
def rotx(x, string, encrypt=true)
alphabet = Array("A".."Z") + Array("a".."z")
results = []
if encrypt == true
key_encrypt_true = Hash[alphabet.zip(alphabet.rotate(x))]
string.chars.each do |i|
if ('a'..'z').include? i
results << key_encrypt_true.fetch(i).downcase
elsif ('A'..'Z').include? i