Skip to content

Instantly share code, notes, and snippets.

View rymai's full-sized avatar
🙌
Working from home

Rémy Coutable rymai

🙌
Working from home
View GitHub Profile
@rymai
rymai / gist:921532
Created April 15, 2011 11:09
SublimeVideo: Autoplay and loop (snippet)
<!-- Inside the <head> tag -->
<script type="text/javascript" src="http://cdn.sublimevideo.net/js/YOUR_TOKEN.js"></script>
<!-- Inside the <body> tag -->
<video id="video1" poster="posterframe.jpg" width="640" height="360" preload="none">
<source src="video.mp4" />
<source src="video.ogv" />
</video>
<!-- Just before </body> (or in the <head> tag) -->
@rymai
rymai / gist:924988
Created April 18, 2011 08:30
SublimeVideo: Interactive thumbnails JavaScript code (jQuery)
var SublimeVideo = SublimeVideo || {};
var InteractiveThumbnailsHandler = function(interactiveWrapperId){
this.interactiveWrapperId = interactiveWrapperId;
this.videosCount = $("#" + this.interactiveWrapperId + " .video_wrap").size();
this.setup();
};
$.extend(InteractiveThumbnailsHandler.prototype, {
setup: function() {
@rymai
rymai / gist:924995
Created April 18, 2011 08:34
SublimeVideo: Interactive thumbnails JavaScript code (Prototype)
var SublimeVideo = SublimeVideo || {};
var InteractiveThumbnailsHandler = Class.create({
initialize: function(interactiveWrapperId) {
this.interactiveWrapperId = interactiveWrapperId;
this.videosCount = $$("#" + interactiveWrapperId + " .video_wrap").size();
$$("#" + this.interactiveWrapperId + " li").each(function(thumb) {
thumb.on("click", function(event) {
event.stop();
@rymai
rymai / gist:925078
Created April 18, 2011 09:33
SublimeVideo: Custom play button JavaScript code (jQuery)
sublimevideo.ready(function() {
$("img.custom_play_button").each(function() {
$(this).click(function(event) {
event.preventDefault();
// Hide the posterframe and prepare and play the video
sublimevideo.prepareAndPlay($(this).attr("id").replace(/^posterframe_/, ""));
$(this).hide();
});
});
});
@rymai
rymai / gist:925086
Created April 18, 2011 09:40
SublimeVideo: Back to poster-frame JavaScript code
// From the documentation: http://docs.sublimevideo.net/javascript-api#onEnd
// You can use sublimevideo.onEnd() to restore the video to its initial state
// (that shows the poster frame and the play button) automatically when the video ends:
sublimevideo.ready(function(){
sublimevideo.onEnd(function(sv){
sublimevideo.stop();
});
});
@rymai
rymai / gist:925199
Created April 18, 2011 12:02
SublimeVideo: Add a shadow around the video tag (snippet)
<!-- Inside the <head> tag -->
<style type="text/css">
.sublimevideo_shadow_box {
-webkit-box-shadow:rgba(0,0,0,0.5) 0 3px 15px;
-moz-box-shadow:rgba(0,0,0,0.5) 0 3px 15px;
box-shadow:rgba(0,0,0,0.5) 0 3px 15px;
}
</style>
<!-- Inside the <body> tag -->
@rymai
rymai / gist:948072
Created April 29, 2011 09:00
SublimeVideo: Magnifying glass on zoomable thumbnail
<!-- Inside the <head> tag -->
<script type="text/javascript" src="http://cdn.sublimevideo.net/js/YOUR_TOKEN.js"></script>
<style type="text/css" media="screen">
#zoomable a {
display:block;
width:180px;
height:76px;
background:#000;
position:relative;
-webkit-box-shadow:rgba(0,0,0,0.4) 0 4px 10px;
@rymai
rymai / gist:951305
Created May 2, 2011 08:30
SublimeVideo: Lightbox from a text link
<!-- Inside the <head> tag -->
<script type="text/javascript" src="http://cdn.sublimevideo.net/js/YOUR_TOKEN.js"></script>
<!-- Inside the <body> tag -->
<a class="sublime" href="video.mp4">
Click here to view the video
</a>
<video class="sublime zoom" poster="posterframe.jpg" width="800" height="336" preload="none" style="display:none">
<source src="video.mp4" />
<source src="video.ogv" />
@rymai
rymai / awesomer.rb
Created June 2, 2011 00:29 — forked from pcreux/awesomer.rb
Convert markdown inline links to link definitions
# For https://github.com/guard/guard/blob/master/CHANGELOG.md
input, output, people = File.read('CHANGELOG.md'), "", {}
input.each_line do |line|
if found = line.match(/\[@(\w+)\]\(([\w:\/.]+)\)/)
user, url = found[1], found[2]
people[user] = url unless people.include?(user)
end
end
@rymai
rymai / gist:1014523
Created June 8, 2011 14:29
SublimeVideo: Google Analytics integration
<!-- Inside the <head> tag -->
<script type="text/javascript" src="http://cdn.sublimevideo.net/js/YOUR_TOKEN.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['sv._setAccount', 'UA-XXXXX-X']);
_gaq.push(['sv._trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);