Skip to content

Instantly share code, notes, and snippets.

View joncode's full-sized avatar
🏠
Launching Apps

Jon Anders joncode

🏠
Launching Apps
  • Splice / Lucera / Couchtour.tv / Hedera / Giftlocal / Sarson Funds
  • Philadelphia, PA
View GitHub Profile
@joncode
joncode / gist:2504705
Created April 27, 2012 00:57
Rails Routes explained
<%= link_to 'Back', @cart %>
links you back to the controller and show action for @cart
<%= link to controller: 'store', action: 'new' %>
is now
<%= link to new_store_path %>
@joncode
joncode / gist:2505387
Created April 27, 2012 03:17
adding params to link_to
using link_to via AJAX to update quantities on a form ... here is the code that passes the new quantity amount ...
<%= link_to ' ^ ', line_item_path(line_item, :amount => 1),
method: :put,
remote: true %>
NOTE - this will NOT work without the object (line_item) in the parenths with the :amount
@joncode
joncode / jquery.replaceWith.example
Created April 27, 2012 23:13 — forked from robertSahm/jquery.replaceWith.example
jQuery replace with exampe
$('.guitarClick1 a').click(function() {
$('h2.chooseInstrument').replaceWith('<h2 class="chooseInstrument">Step 2: Choose a body style</h2>');
})
@joncode
joncode / gist:2521919
Created April 28, 2012 20:45
installing Compass Gem
> gem install 'compass'
add to Gemfile in app - assets block
group :assets do
gem 'compass'
gem 'sass-rails', '~> 3.1.4'
# gem 'coffee-rails', '~> 3.1.1'
# gem 'uglifier', '>= 1.0.3'
end
> bundle install
@joncode
joncode / gist:2565964
Created May 1, 2012 07:34
uploading local git repo to github
git remote add origin [email protected]:joncode/wibble.git
you have to include the word 'origin' for this to work
@joncode
joncode / gist:2579053
Created May 2, 2012 18:35
overwrite scaffold with twitter bootstrap styles
rails g bootstrap:themed videos -f
where videos is the scaffold to be styled by twitter bootstrap
the '-f' flag means force -- i.e. delete any styles that are there already
@joncode
joncode / gist:2604986
Created May 5, 2012 19:36
HTML5 video attirbutes
control - boolean gives you controls on screen
autoplay - boolean starts playing the vid automatically
preload="none" ="metadata" ="auto"
- tells browser whether or not to preload the video entirely , just metadata or not at all
poster="src of poser frame"
- loads an image into the player as poster frame pre-play
loop - loops video , does not work in firefox - use JS to make looper
<script>
$('#videoShow').bind("ended", function() {
this.play();
@joncode
joncode / gist:2623365
Created May 6, 2012 17:17
W3C HTML vidoe and media links
http://www.w3.org/TR/html5/the-video-element.html#the-video-element
http://www.w3.org/TR/html5/media-elements.html#media-data
http://www.w3.org/TR/html5/media-elements.html#concept-media-load-algorithm
@joncode
joncode / gist:2631362
Created May 7, 2012 23:18
HTML video events
"progress"
"timeupdate"
"durationchange" - whenever the duration of the video content changes , including at load
"canplaythrough"
"loadeddata"
"playing"
"paused"
.ended
.buffered
.duration
@joncode
joncode / gist:2631875
Last active October 4, 2015 11:58
annotations - schema in model files
group :development do
gem 'annotate', '~> 2.4.1.beta'
end
bundle install
bundle exec annotate --position after