Skip to content

Instantly share code, notes, and snippets.

View whitmanc's full-sized avatar

Chris Whitman whitmanc

View GitHub Profile
initSortable: =>
$(@el).sortable
opacity: 0.6
cursor: 'move'
containment: 'footer'
update: =>
#ids = App.keyframeList().collection.pluck('id')
#console.log ids
@json = {}
@whitmanc
whitmanc / gist:3360240
Created August 15, 2012 13:37
Cocos2d-iphone prevent physics objects overlap
- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint touchPoint = [touch locationInView:[touch view]];
touchPoint = [[CCDirector sharedDirector] convertToGL:touchPoint];
if(isTouch){
//
// Move the flake, check into consideration finger placement
// relative to the flake
root :to => 'home#index', :constraints => lambda { |request| request.cookies['auth_token'] }
root :to => 'user_sessions#new'
source 'http://rubygems.org'
gem 'rails', '3.2.6'
gem 'mysql2'
group :assets do
gem 'sass-rails', "~> 3.2.0"
gem 'coffee-rails', "~> 3.2.0"
gem 'uglifier'
$ cap deploy:cold
* executing `deploy:cold'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote [email protected]:whitmanc/sisbro.git master"
command finished in 6192ms
* executing "if [ -d /data/spree/shared/cached-copy ]; then cd /data/spree/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard c1ab496b2fd316e1dac3b2f2d08b842fe401a432 && git clean -q -d -x -f; else git clone -q [email protected]:whitmanc/sisbro.git /data/spree/shared/cached-copy && cd /data/spree/shared/cached-copy && git checkout -q -b deploy c1ab496b2fd316e1dac3b2f2d08b842fe401a432; fi"
servers: ["50.116.11.162"]
@whitmanc
whitmanc / gist:2973169
Created June 22, 2012 14:43
jQuery force HTTP PUT method
$.ajax({
...
beforeSend: function(xhr)
{
xhr.setRequestHeader("X-Http-Method-Override", "PUT");
}
});
var strDataURI = oCanvas.toDataURL();
// returns "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACt..."
view plaincopy to clipboardprint?
var strDataURI = oCanvas.toDataURL("image/jpeg");
// returns "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAA..."
Canvas2Image.saveAsPNG(oCanvas); // will prompt the user to save the image as PNG.
@whitmanc
whitmanc / gist:2869427
Created June 4, 2012 16:32
Disable jquery-file-upload
$('#fileupload').fileupload('disable');
$('#fileupload').fileupload('enable');
We couldn’t find that file to show.
var t = $(this);
if (!(t.hasClass("scene") || t.hasClass("keyframe") || t.hasClass("edit-text") || t.hasClass("disabled") || t.hasClass("images"))) {
// codes
}