This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rescue_from ActionView::MissingTemplate do |e| | |
self.formats = [:html] | |
render "#{params[:action]}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.geolocation.getCurrentPosition(locationSuccess, locationFail); | |
function locationSuccess(position) { | |
latitude = position.coords.latitude; | |
longitude = position.coords.longitude; | |
} | |
function locationFail() { | |
alert(‘Oops, could not find you.’); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hide URL bar for iOS and android | |
hideAddressBar = function(){ | |
if (navigator.userAgent.match(/Android/i)) { | |
window.scrollTo(0,0); // reset in case prev not scrolled | |
var nPageH = $(document).height(); | |
var nViewH = window.outerHeight; | |
if (nViewH > nPageH ) { | |
nViewH = nViewH / window.devicePixelRatio; | |
$('body').css('height',nViewH + 'px'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.connection.tables.map do |table| | |
table.capitalize.singularize.camelize | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.descendants.collect { |type| type.name }.sort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/initializers/browsercms.rb | |
#... | |
Cms::DomainSupport.class_eval do | |
def cms_site? | |
true && current_user.able_to?(:administrate, :edit_content, :publish_content) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<tr> | |
<td style="color: #373737;font-size: 12px; border-bottom: 1px solid #ACDAE3; padding: 10px;"><%= image_tag("/images/checkbox#{entry.bloating? ? '-checked' : ''}.png") %></td> | |
<td style="color: #373737;font-size: 12px; border-bottom: 1px solid #ACDAE3; padding: 10px;">Bloating</td> | |
</td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("ul#sidebar_whatever").sortable({ | |
placeholder: "ui-state-highlight", | |
update: function(event, ui) { //this is where we'll do some updating crap | |
$("ul#sidebar_whatever").find('li.widget').each(function(){ | |
var val = $(this).find('input.hidden_cool_input').val();// this val will be like "124,1" | |
var result = val.split(','); | |
var order = $("ul#sidebar_whatever li.widget").index($(this))//getting the order of the current element in the loop | |
result[1] = order; // we're reassigning the order | |
$(this).find('input.hidden_cool_input').val(result.toString());//we're putting the values back in, as "124,0" or "125,3" or whatever. | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin gradient($first, $second, $colorstop:0) { | |
background: $first; | |
background: -webkit-gradient(linear, left top, left bottom, from($first), color-stop($colorstop, $first), to($second)); | |
background: -moz-linear-gradient(top, $first $colorstop, $second); | |
} | |
@mixin border-gradient($first, $second, $colorstop:0) { | |
border-color:$first; | |
border-style:double; | |
-webkit-border-image: -webkit-gradient(linear, 0 100%, 0 0, from($first), to($second)) 1 100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//sessions.css.scss - file #1 that i only want to let the _style.scss import be included once | |
$imported-once-files: (); | |
@function import-once($name) { | |
@if index($imported-once-files, $name) { | |
@return false; | |
} | |
$imported-once-files: append($imported-once-files, $name); | |
@return true; |