This file contains 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
def generate_canonical_link | |
prefix = '?' | |
href_attr = "#{request.env['rack.url_scheme']}://#{SERVICE_DOMAIN}#{request.env['REQUEST_PATH']}" | |
if (params[:page] && params[:page].to_i != 1) | |
href_attr += "#{prefix}page=#{params[:page]}" | |
prefix = "&" | |
end | |
if params[:query] |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>light show</title> | |
<style> | |
ul { | |
list-style-type: none; | |
} | |
li { | |
width: 10px; |
This file contains 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
var DisableLinksOnDragObserver = Class.create({ | |
initialize: function(element){ | |
this.drag = false; | |
this.clearDragMarker = this.clearDragMarker.bind(this); | |
Event.delegate(element, 'a', 'click', this.disableClick.bind(this)); | |
}, | |
onStart: function(){ | |
this.drag = true; | |
}, |
This file contains 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
(function($, doc) { | |
var getHTML; | |
if ('outerHTML' in doc.documentElement) { | |
getHTML = function getHTML() { | |
return $.String(this.raw.outerHTML); | |
}; | |
} else { | |
var dummy = doc.createElement('html'); | |
getHTML = function getHTML() { |
This file contains 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
<select name="add_filter" id="add_filter"> | |
<option></option> | |
<option value="n_ticket" >Nº do ticket</option> | |
<option value="priority">Prioridade</option> | |
<option value="category">Categoria</option> | |
<option value="module">Módulo</option> | |
<option value="subject">Título</option> | |
<option value="date_sol">Data de solicitação</option> | |
<option value="solicitant">Solicitante</option> | |
<option value="status">Status</option> |
This file contains 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
<?php | |
/* | |
Original version: | |
written by Jarrod Oberto | |
taken from http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/ | |
Example usage: | |
include("classes/Resize.php"); |
This file contains 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
(function(){ | |
function isForm(element) { | |
return element.nodeName.toUpperCase() == 'FORM'; | |
} | |
function isInput(element) { | |
var name = element.nodeName.toUpperCase() | |
return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA'; | |
} |
This file contains 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
S2.FX.TOGGLE_PAIRS = { | |
'fade': ['fade', 'appear'], | |
'slide': ['slideUp', 'slideDown'] | |
}; | |
Element.addMethods({ | |
toggleWithEffect: function(element, effect, options){ | |
element = $(element) | |
effect = (S2.FX.TOGGLE_PAIRS[effect] || S2.FX.TOGGLE_PAIRS['fade'])[+element.visible()]; | |
return element.effect(effect, options); |
This file contains 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
CD3.Behaviors.shortcuts({ | |
'cmd+f:#section': App.search, // for windows will translated to ctrl+f | |
'esc': { | |
'.new_task': App.cancelNewTask, | |
'.task': App.cancelEditTaskForm, | |
'.new_comment': App.cancelNewComment, | |
'.comment': App.cancelEditComment | |
}, | |
'shift+up': { | |
'.task': App.moveTask('up'), |
This file contains 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
# fix for send_reset_password_instructions with different authentication_keys than email | |
module Devise | |
# lib/devise/models/authenticatable.rb | |
module Models | |
def find_or_initialize_with_errors(attributes, error=:invalid) | |
attributes = attributes.slice(*authentication_keys) | |
attributes.delete_if { |k, v| !v.present? } | |
if attributes.size == authentication_keys.size | |
record = find(:first, :conditions => attributes) |