Skip to content

Instantly share code, notes, and snippets.

Stephen Hunter Arcolye

Block or report user

Report or block Arcolye

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app-assets-javascripts-photos.js.coffee
# Selecting a photo to upload shows photo and filename instantly
placeSelectedPhotoPreview = (input) ->
if input.files && input.files[0]
reader = new FileReader()
reader.readAsDataURL(input.files[0])
reader.onload = (e) ->
$(input).closest('.thumbnail').find('img#photo-preview').attr("src", e.target.result)
$(input).closest('.thumbnail').find("#upload-filename").html(input.files[0].name)
# When a photo is selected
@Arcolye
Arcolye / gengo_translation_api_wrapper.rb
Last active Jan 26, 2017
GoToStudy - Gengo Translation API wrapper
View gengo_translation_api_wrapper.rb
# Gengo provides an API to their human translation service
# https://gengo.com/developers/
class GengoTranslation
require 'gengo'
attr_accessor :gengo
def initialize(sandbox: false)
sandbox = true unless Rails.env.production?
@Arcolye
Arcolye / spec-features-agency_office_spec.rb
Last active Jan 26, 2017
GoToStudy - Agency Office Spec
View spec-features-agency_office_spec.rb
require 'spec_helper'
feature "AgencyOffice" do
let(:agency) { create(:agency) }
scenario "makes agency visible on relevant country page" do
visit country_path(agency.offices.first.country)
expect(page).to have_content agency.name
@Arcolye
Arcolye / app-views-lessons-show.html.erb
Last active Jan 26, 2017
A Ruby on Rails view. Bootstrap is used semantically, with Bootstrap classes included only in the .scss
View app-views-lessons-show.html.erb
<%= pgtitle @lesson %>
<%= description @lesson.meta_description.presence || @lesson.description.presence %>
<div class="lesson">
<%= section class: "lesson-header" do %>
<div class="lesson-icon-wrapper">
<div class="lesson-icon">
<%= image_tag @lesson.icon %>
@Arcolye
Arcolye / gist:407371a24d3c27a33045
Created Apr 28, 2015
Morse Code Generator for Sonic Pi
View gist:407371a24d3c27a33045
#MORSE CODE GENERATOR
#ENTER A MESSAGE AND PRESS RUN
message = 'Morse code is old'
#CUSTOMIZE
words_per_minute = 18 # slow:12, standard: 18, fast: 24
@u = 1.2 / words_per_minute #One time unit (length of 1 dot)
@looped = true #comment out to play message only once
@pitch = 83
You can’t perform that action at this time.