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(jQuery) { | |
// All new jQuery goes here | |
})(jQuery.noConflict(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 setEndOfContenteditable(contentEditableElement) | |
{ | |
var range,selection; | |
if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+ | |
{ | |
range = document.createRange();//Create a range (a range is a like the selection but invisible) | |
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range | |
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start | |
selection = window.getSelection();//get the selection object (allows you to change selection) | |
selection.removeAllRanges();//remove any selections already made |
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
# | |
# Proof of concept for a HAProxy maintenance mode | |
# | |
# | |
# Control the maintenance page during runtime using the stats socket: | |
# | |
# To put the whole site in maintenance mode (for all IPs): | |
# > add acl #0 0.0.0.0/0 | |
# | |
# To exclude your own ip, so you are able to test things out: |
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
defmodule FhForm.API.HTML.FormResponseController do | |
use FhForm.Web, :controller | |
alias FhForm.Form | |
alias FhForm.FormResponse | |
def create(conn, params) do | |
IO.inspect params | |
form = Repo.get_by(Form, url_iden: params["url_identifier"]) | |
changeset = |
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
<cfscript> | |
// Grab local content index (feed) by name. I believe siteid is optional, but I have always included it. | |
var feed = application.feedManager.readByName('Banners', $.event("siteid")); | |
// Create a content iterator from the feed. | |
var banners = feed.getIterator(); | |
// HTML to add to. | |
var html = ""; |
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
<cfscript> | |
// feed | |
local.dynamicFeed=$.getBean('feed'); | |
local.dynamicFeed.setName('tempFolder'); | |
local.dynamicFeed.setIsActive(1); | |
local.dynamicFeed.setIsFeature(1); | |
local.dynamicFeed.setSortBy('orderno'); // lastUpdate, releaseDate, displayStart, menuTitle, rating, comments, created, orderno, random | |
local.dynamicFeed.setMaxItems(1); // 0=unlimited | |
local.dynamicFeed.setNextN(50); // use the content's own settings |
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
<cffunction name="dspCrumblistLinks" output="false" returntype="string"> | |
<cfargument name="id" type="string" default="crumblist"> | |
<cfargument name="separator" type="string" default=""> | |
<cfargument name="class" type="string" default=""> | |
<cfset var thenav="" /> | |
<cfset var theOffset=arrayLen(this.crumbdata)- this.navOffSet /> | |
<cfset var I = 0 /> | |
<cfif arrayLen(this.crumbdata) gt (1 + this.navOffSet)> | |
<cfsavecontent variable="theNav"> | |
<cfoutput><ul<cfif len(arguments.id)> id="#arguments.id#"</cfif><cfif len(arguments.class)> class="#arguments.class#"</cfif>> |
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
validates :name, presence: true, length: { within: 1..31 }, uniqueness: { scope: :created_by, message: { code: 'non-unique', data: { ->{ find_unique('name') }} } } | |
def find_unique(name) | |
..uniqueness magical find... | |
end |
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
{ | |
"errors": { | |
"name": [ | |
"is already taken" | |
] | |
} | |
} |
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
class AppResponder < ActionController::Responder | |
def to_format | |
if get? && !resource | |
controller.response.status = :not_found | |
elsif has_errors? | |
controller.response.status = :unprocessable_entity | |
elsif post? | |
controller.response.status = :created | |
end |
NewerOlder