Skip to content

Instantly share code, notes, and snippets.

<script>
window.AudioContext = (function(){
return window.webkitAudioContext || window.AudioContext ;
})();
// Global variables
var audioContext;
var audioBuffer = 0;
var audioUrl = "/tutorial_support/5/Doctor_Who_theme_excerpt.ogg";
@craic
craic / tutorial_5_example_1.html
Last active December 27, 2015 05:09
Use the <audio> tag to play an audio file in a web page
<audio autoplay="autoplay" controls="controls">
<source src="/assets/Doctor_Who_theme_excerpt.ogg" />
<p>Your browser does not support the audio element.</p>
</audio>
@craic
craic / tutorial_4_example_1.html
Last active December 27, 2015 04:59
Embed a YouTube video in your web page
<iframe width="420" height="315" src="//www.youtube.com/embed/vzeBDcmrjjY" frameborder="0" allowfullscreen></iframe>
@craic
craic / tutorial_3_example_1.html
Created November 1, 2013 18:31
Example of a Forecast Embed weather forecast widget from forecast.io
<iframe id="forecast_embed" type="text/html" frameborder="0" height="245" width="100%"
src="http://forecast.io/embed/#lat=69.649205&lon=18.955324&name=Tromso, Norway&color=#00aaff&font=Helvetica&units=us">
</iframe>
@craic
craic / tutorial_3_example_1.html
Last active March 10, 2017 00:13
Embed a Weather Forecast from forecast.io in a web page
<iframe id="forecast_embed" type="text/html" frameborder="0" height="245" width="100%"
src="http://forecast.io/embed/#lat=64.133753&lon=-21.879272&name=Reykjavik, Iceland&color=#00aaff&font=Helvetica&units=us">
</iframe>
@craic
craic / tutorial_2_demo_2.html
Last active December 26, 2015 22:39
Widget from Twitter to embed a twitter feed in a web page
<a class="twitter-timeline" href="https://twitter.com/BBCWorld" data-widget-id="395313647477481472">Tweets by @BBCWorld</a>
<script>!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;
js.src=p+"://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");
@craic
craic / tutorial_2_example_1.html
Last active December 26, 2015 22:39
Example of code to embed a single tweet in a web page
<blockquote class="twitter-tweet">
<p>Brazil to export low-cost measles &amp; rubella vaccines to developing countries
<a href="http://t.co/moEfOssAqQ">http://t.co/moEfOssAqQ</a>
</p>
&mdash; BBC News (World) (@BBCWorld)
<a href="https://twitter.com/BBCWorld/statuses/395287088033447936">October 29, 2013</a>
</blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
@craic
craic / tutorial_1_example_1.html
Last active December 26, 2015 14:09
Simple example of embedding a Google Map in a web page
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=eiffel+tower,+Paris,+France&amp;aq=t&amp;sll=47.613028,-122.342064&amp;sspn=0.367071,0.644073&amp;ie=UTF8&amp;hq=&amp;hnear=&amp;t=m&amp;iwloc=A&amp;ll=48.858228,2.294388&amp;spn=0.006295,0.006295&amp;output=embed"></iframe>
<br />
<small>
<a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=eiffel+tower,+Paris,+France&amp;aq=t&amp;sll=47.613028,-122.342064&amp;sspn=0.367071,0.644073&amp;ie=UTF8&amp;hq=&amp;hnear=&amp;t=m&amp;iwloc=A&amp;ll=48.858228,2.294388&amp;spn=0.006295,0.006295" style="color:#0000FF;text-align:left">View Larger Map</a>
</small>
@craic
craic / jquery_hide_show_tags.html
Created February 19, 2013 16:05
HTML page containing Javascript code that illustrates two approaches to hiding tag pairs on a page. See also this blog post: http://craiccomputing.blogspot.com/2013/02/jquery-snippet-to-remove-links-from-page.html
<!DOCTYPE html>
<html>
<head>
<title>Jquery Tag show / hide</title>
<style>
body {
font-family: Helvetica;
font-size:11pt;
padding:5px;
@craic
craic / meta_search_custom_column_sort.rb
Created June 10, 2011 17:53
This gist includes a Rails helper and controller code that lets you sort on custom columns alongside the meta-search gem search and sort features
# Helper method - place in application_helper.rb
def custom_sort_helper(path, sort_term, sort_label, search, sort_string)
uri = String.new(path)
# copy the current search terms but exclude meta_sort
search_array = Array.new
search.search_attributes.each { |key, val| (search_array << "search[#{key}]=#{val}") unless key == 'meta_sort' }
uri << '?'