Skip to content

Instantly share code, notes, and snippets.

View moski's full-sized avatar

Moski Doski moski

View GitHub Profile
@moski
moski / upload.coffee
Created January 6, 2012 16:34
plupload + Coffeescript + Rails 3
window.initUploader = () ->
uploader = new plupload.Uploader({
runtimes : 'html5,flash,silverlight,',
browse_button : 'drop_zone_home',
drop_element : 'drop_zone_home',
container : 'uploadContainer',
max_file_size : '10mb',
url : '/posts',
flash_swf_url : '/swf/plupload.flash.swf',
silverlight_xap_url : '/swf/plupload.silverlight.xap',
@moski
moski / array_case1.coffee.js
Created January 18, 2012 21:56
Array problem Case 1
if (index < sectionWidth)
startIndex = 0
endIndex = 2 * sectionWidth
@moski
moski / array_problem_inputs.coffee
Created January 20, 2012 17:06
Array problem - Inputs
sectionWidth = 5
length = array.length
@moski
moski / array_case2.coffee
Created January 20, 2012 17:24
Array problem Case 2
else if (index + sectionWidth) > (length + 1)
startIndex = (length - 1) - (2 * sectionWidth)
endIndex = (length - 1)
@moski
moski / array_case-all.coffee
Created January 20, 2012 17:40
Array problem Code - All
sectionWidth = 5
length = array.length
if (index < sectionWidth)
startIndex = 0
endIndex = 2 * sectionWidth
else if (index + sectionWidth) > (length + 1)
startIndex = (length - 1) - (2 * sectionWidth)
endIndex = (length - 1)
@moski
moski / index.html
Last active September 29, 2015 18:48
Script to include in your blogger posts to enable gist embeds.
<script src="https://raw.githubusercontent.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"></script>
@moski
moski / template.html
Created January 20, 2012 20:12
Gist embed template
<div class="gistLoad" data-id="GistID" id="gist-GistID">Loading ....</div>
@moski
moski / wait-1.coffee
Created January 26, 2012 13:51
Wait for Images to load + jquery
# blog post: http://blog.moski.me/2012/01/image-load-event-binding.html
# Assuming All the images we want to preload reside in ".images-preload"
imageTotal = $(".images-preload img").length
imageCount = 0
$(".images-preload img").load( () ->
if(++imageCount == imageTotal)
console.log("Any Callback Function");
else
@moski
moski / wait-2.coffee
Created January 26, 2012 14:09
Wait for Images to load + jquery + IE Fix
#blog post: http://blog.moski.me/2012/01/image-load-event-binding.html
# Assuming All the images we want to preload reside in ".images-preload"
imageTotal = $(".images-preload img").length
imageCount = 0
$(".images-preload img").each( () ->
$(@).attr('src', $(@).attr('src') + '?iemustdie=' + (new Date()).getTime())).load(() ->
if(++imageCount == imageTotal)
@moski
moski / istikana.sh
Created January 26, 2012 17:09
Isktikana + plex Setup
# blog post http://blog.moski.me/2012/01/blog-post_26.html
cd ~/Library/Application Support/Plex Media Server/Plug-ins
git clone git@github.com:moski/istikana.bundle.git