Skip to content

Instantly share code, notes, and snippets.

@dgalarza
dgalarza / dynamic_rails_form.js
Created October 2, 2012 14:22
Dynamic Rails Form
// -- This method adds a field to the form:
var addField = function(target){
// -- get handle on relevant fieldset container and clone it:
var fieldset = target.parent().parent().find('div.item-fields').last();
var new_fieldset = fieldset.clone();
// -- Add flag to show that field was dynamically built by the front end
// -- and show fieldset if the original was hidden:
new_fieldset.addClass("new-dynamic-field").show();
new_fieldset.find("input.placeholder-activated").removeClass("placeholder-activated");
@dgalarza
dgalarza / gist:3248130
Created August 3, 2012 14:28 — forked from rowan-m/gist:1026918
update jenkins Updatecenter from CLI
$ java -jar jenkins-cli.jar -s http://localhost:9000 install-plugin findbugs
findbugs is neither a valid file, URL, nor a plugin artifact name in the update center
No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
findbugs looks like a short plugin name. Did you mean 'null'?
# Specifying a full URL works!
$ java -jar jenkins-cli.jar -s http://localhost:9020 install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi
# Get the update center ourself
@dgalarza
dgalarza / notes.md
Created July 25, 2012 19:42 — forked from searls/notes.md
Stack traces I get when I attempt to install native Ruby extensions on OS X 10.8 Mountain Lion Developer Preview

Trying to make my Ruby environment happy under OS X 10.8 Mountain Lion

A few notes. I had:

  • installed XCode 2.4 Preview as well as its command line tools (which are found separately in Preferences -> Downloads)
  • updated rvm (rvm get latest)

and my issue was:

  • system ruby installed every gem with native extensions I threw at it
@dgalarza
dgalarza / scheduled_job.rb
Created July 17, 2012 20:23 — forked from kares/scheduled_job.rb
Recurring Job using Delayed::Job
#
# Recurring Job using Delayed::Job
#
# Setup Your job the "plain-old" DJ (perform) way, include this module
# and Your handler will re-schedule itself every time it succeeds.
#
# Sample :
#
# class MyJob
# include Delayed::ScheduledJob
@dgalarza
dgalarza / gist:3040209
Created July 3, 2012 14:51 — forked from lusis/gist:1047214
update jenkins Updatecenter from CLI
$ java -jar jenkins-cli.jar -s http://localhost:9000 install-plugin findbugs
findbugs is neither a valid file, URL, nor a plugin artifact name in the update center
No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
findbugs looks like a short plugin name. Did you mean 'null'?
# Specifying a full URL works!
$ java -jar jenkins-cli.jar -s http://localhost:9020 install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi
# Get the update center ourself
@dgalarza
dgalarza / swipe.js
Created June 20, 2012 16:11
Swiping example
var start_location, end_location
$portfolio_modal = $('#portfolio-modal');
$portfolio_modal.bind('touchstart', function(e) {
start_location = e.originalEvent.targetTouches[0].pageX;
return end_location = 0;
});
$portfolio_modal.bind('touchmove', function(e) {
@dgalarza
dgalarza / jquery_css_transitions.js
Created March 14, 2012 17:36
jQuery CSS Transition Fallbacks
(function (window, doc, $, undefined) {
// Check for CSS3 Transition Support
var css_transitions = function() {
var el = doc.createElement('div');
var vendors = ['Khtml', 'Ms', 'Moz',' Webkit','O'];
for (var i = 0, len = vendors.length; i < len; i++) {
var prop = vendors[i] + 'Transition';
if (prop in el.style) return true;
@dgalarza
dgalarza / manual_sprites.scss
Created February 2, 2012 15:56
Compass Custom Sprites Definitions
@import 'compass/utilities/sprites/base';
$sprite-spacing: 1px;
$social_sprite: sprite-map('social-sprite/*.png', $spacing: $sprite-spacing);
@mixin sprite-dimensions($sprite, $image_name) {
height: image-height( sprite-file($sprite, $image_name) );
width: image-width( sprite-file($sprite, $image_name) );
}
@dgalarza
dgalarza / rptr_queue_animation.js
Created January 31, 2012 17:39
Raptor Queue Animation
interval_callbacks : {};
intervals : {}
queue_animation : function (interval, delay, fn, id) {
_animation_stack.push_to_queue(interval, fn, id);
_animation_stack.create_interval(interval, delay);
},
push_to_queue : function (interval, fn, id) {
if (!this.interval_callbacks[interval]) this.interval_callbacks[interval] = {};
@dgalarza
dgalarza / libmysql_mysql2_gem.sh
Created January 17, 2012 04:00
Resolve OSX mysql2 gem libmysqlclient.18.dylib (LoadError)
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH