Skip to content

Instantly share code, notes, and snippets.

View jonwolfe's full-sized avatar

Jonathon Wolfe jonwolfe

View GitHub Profile
@jonwolfe
jonwolfe / gist:7897610
Created December 10, 2013 20:22
This is how we use Google Analytics with Turbolinks. I put this in a analytics.js.coffee file and require it after turbolinks. That's it. Works on browsers that support Turbolinks and those that don't. Also works with parts of your app that may not use Turbolinks. If you need to record pageviews manually for any reason, just call GoogleAnalytics…
class @GoogleAnalytics
@load: ->
# Google Analytics depends on a global _gaq array. window is the global scope.
window._gaq = []
window._gaq.push ["_setAccount", GoogleAnalytics.analyticsId()]
# Create a script element and insert it in the DOM
ga = document.createElement("script")
ga.type = "text/javascript"
foo = (param, callback) ->
callback param
foo 3, (x) ->
console.log x
en:
recipient_mailer:
verification:
subject: Please confirm your email address.
email_body: |
Thanks for participating in the {survey_title}.
Please click the link below to confirm your email address. By doing so, you'll ensure your responses are counted.
Click here: {url}
$.fn.e = (eventName, callback) ->
console.log 'eventName: ' + eventName + ' callback: ' + callback
$(document).on eventName, this, (event) =>
console.log 'this.html(): ' + this.html() + ' event.currentTarget: ' + event.currentTarget
el = $(event.currentTarget)
callback(event, el)
$('[showmodal]').e 'click', (e, el) ->
href = el.attr('href')
console.log 'click callback called! modal: ' + href
class @E
@on: (selector, eventName, callback) ->
$(document).on eventName, selector, (event) =>
el = $(event.currentTarget)
callback(event, el)
@click: (selector, callback) ->
@on selector, 'click', (event) =>
target = $(event.currentTarget)
# general event handler
$.e = (selector, eventName, callback) ->
$(document).on eventName, selector, (event) =>
el = $(event.currentTarget)
callback(event, el)
# click handler
$.click = (selector, callback) ->
$.e selector, 'click', callback
{
"name": "Vocal Video Charts",
"id": 1,
"colors": {
"common": [
"#FF4C6C",
"#00D1C0",
"#FF7D58",
"#4087F9",
"#A17CFF",
@jonwolfe
jonwolfe / gist:6b114941dde5a7d06ab2bc54c5f1e7d5
Created July 27, 2020 20:47
video markup for videos in ghost posts
without a caption:
<video controls poster=''>
<source type='video/mp4' src=''>
</video>
with a caption:
<figure>
<video controls poster=''>
@jonwolfe
jonwolfe / vocal-video-sized-images.html
Created May 12, 2021 21:58
Right-sizing smaller images in Vocal Video articles
Max 300px wide:
<figure class="kg-card kg-image-card">
<img class="kg-image max-width-300 centered" alt="" src="">
<figcaption>Optional caption here</figcaption>
</figure>
Max 400px wide:
<figure class="kg-card kg-image-card">