Skip to content

Instantly share code, notes, and snippets.

View tjFogarty's full-sized avatar
🇮🇪

T.J. Fogarty tjFogarty

🇮🇪
View GitHub Profile
//simply use Vimeo.init(); to find the videos and bind the events
var Vimeo = {
// we can add more events when we need to, e.g. onPause
events: {
// when videos are ready, we can attach our events
ready: function( player_id ) {
$f(player_id).addEvent( 'play', Vimeo.events.onPlay );
},
//when the play button is clicked
@tjFogarty
tjFogarty / page.js
Created December 8, 2012 18:47
Do things with the page name
var Page = {
getPageName: function() {
var pageName = document.URL.split( '/' ).pop();
if( !pageName ) {
pageName = $( 'ul.menu li:first-child a' ).attr( 'href' );
}
return pageName;
@tjFogarty
tjFogarty / slider.js
Created December 4, 2012 23:31
A sort of image slider logic
// replace background image when user clicks on a thumbnail
$projectImages.live( 'click', function(e) {
e.preventDefault();
var $this = $( this ),
$bgImage = $( '.current-section .bg-image' ),
oldSrc = $bgImage.attr( 'src' ),
newSrc = $this.find( 'img' ).attr( 'src' ),
marginValue = $this.width() + 20, // 20 for the 10px margin-left and right
newThumbnail = '<li><a href="#"><img src="' + oldSrc + '" class="scale-with-grid"></a></li>',
newBgImage = '<img src="' + newSrc + '" alt="" class="bg-image">';
@tjFogarty
tjFogarty / reverseString.java
Created November 19, 2012 23:20
Reverse a string in java
public class ReverseString {
public static void main(String[] args) {
String reversed = reverseString( "Reverse this string." );
System.out.println( reversed );
}
public static String reverseString( String newString ) {
// cleans up string if there are any extra spaces