Skip to content

Instantly share code, notes, and snippets.

View snikch's full-sized avatar
🎛️

Mal Curtis snikch

🎛️
  • inMusic
  • Auckland, New Zealand
  • 12:27 (UTC +12:00)
  • X @snikchnz
View GitHub Profile
@snikch
snikch / captions2 plugin
Created October 4, 2010 04:53
JWPlayer 5 Captions Plugin, with y axis margin variable.
package {
import com.longtailvideo.jwplayer.events.ViewEvent;
import com.longtailvideo.jwplayer.events.MediaEvent;
import com.longtailvideo.jwplayer.events.PlayerStateEvent;
import com.longtailvideo.jwplayer.events.PlaylistEvent;
import com.longtailvideo.jwplayer.player.IPlayer;
import com.longtailvideo.jwplayer.player.PlayerState;
import com.longtailvideo.jwplayer.plugins.IPlugin;
import com.longtailvideo.jwplayer.plugins.PluginConfig;
import com.longtailvideo.jwplayer.utils.Logger;
@snikch
snikch / Light Weight jQuery Validation Plugin
Created November 23, 2010 06:49
A spec for a light weight jQuery validation plugin with schemas not classes
* Must NOT use class="required" validation
* Must use Javascript objects for validation
var schema = {
options : {
'bubble' : true, // Bubble validation checks to all elements, if false will stop on fail
'blur' : false, // Will not call the validate method on the inputs
'auto' : false, // Will not attempt to apply to all forms, just ID matched forms
'decorator' : 'inline' // Defaults to supplied decorator, but a decorator can be supplied
@snikch
snikch / gist:2245975
Created March 30, 2012 02:38
Hacking a PL2303 LED Badge in Mac OS (Code Mania attendee badge)
1) Install the PL2303 Lion driver from http://changux.co/osx-installer-to-pl2303-serial-usb-on-osx-lio
2) Install the CrossOver trial http://www.codeweavers.com/products/cxmac/
3) Install the 'LED Mini Board' software as a CrossOver app http://www.prolific.com.tw/eng/downloads.asp?id=31
4) Plug in your device, then symlink the mounted device in /dev to the `dosdevices` folder in your CrossOver app
cd ~/Library/Application\ Support/CrossOver/Bottles/Setup.exe/dosdevices # Where Setup.exe is the CrossOver app that was created
ln -s /dev/cu.PL2303-00001004 com1 # Your /dev/ mount name may be slightly different
@snikch
snikch / resque.rake
Created April 12, 2012 21:46 — forked from kenmazaika/Console Output
Start and Stop tasks for resque workers the intelligent way, forking the process for speed and reduced load.
require 'resque/tasks'
namespace :resque do
task :setup => :environment
# From https://gist.github.com/1870642
desc "Restart running workers"
task :restart_workers => :environment do
Rake::Task['resque:stop_workers'].invoke
Rake::Task['resque:start_workers'].invoke
end
@snikch
snikch / gist:2582549
Created May 3, 2012 02:05
Prevent AssetNotPrecompiledError before it occurs.
# Checks that the precompile list contains this file or raises an error, in dev only
# Note: You will need to move config.assets.precompile to application.rb from production.rb
def javascript_include_tag *sources
sources.each do |source|
raise "Hey, #{source} is not in the precompile list. This will fall apart in production." unless Rails.application.config.assets.precompile.any? do |matcher|
if matcher.is_a? Proc
matcher.call(source)
elsif matcher.is_a? Regexp
matcher.match(source)
else
# install git
sudo aptitude -y install curl git git-core
# get the vmconfig repo
git clone git@github.com:learnable/vmconfig.git
cd vmconfig
# start the automated script
./learnable-development-vm.sh
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
class App.ProjectsController extends App.ApplicationController
@scope 'all'
@show: (a,b,c) =>
console.log "SHOWING"
# How do I get my model. Is this just completely wrong?
def index
filters = {}
filters[:categories_filter] = params[:categories].split(',') unless params[:categories].blank?
filters[:questions_filter] = params[:questions].split(',') unless params[:questions].blank?
@questions = QuestionFilter.new(filters).questions
end
require 'formula'
class Cgminer < Formula
homepage 'https://github.com/ckolivas/cgminer'
url 'https://github.com/ckolivas/cgminer/archive/v2.11.4.zip'
head 'https://github.com/ckolivas/cgminer.git', :using => :git
md5 'd41d210b03ee16c9ad4cfb439916b30a341dc9b6'
depends_on 'autoconf' => :build
depends_on 'automake' => :build