- Install stud
$ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb - Download and install the powssl script
$ curl https://raw.github.com/gist/2050941/3ea59efe8c7e9013c265313045a9fdda5c653963/powssl > ~/bin/powssl$ chmod +x ~/bin/powssl - Run powssl to create development certificate and configure stud.
$ powssl
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
| /************************************ | |
| * Clickables (big block targets) | |
| ***********************************/ | |
| var Clickables = Class.create({ | |
| initialize: function(options) { | |
| selector = $$(options.selector) || $$(".clickables"); | |
| this.clickable = options.clickable || "li"; | |
| this.hoverclass = options.hoverclass || "over"; |
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
| /********************************************** | |
| * Flash Player Detection (taken from sifr ) | |
| **********************************************/ | |
| var hasFlash = function(){ | |
| var nRequiredVersion = 9; | |
| if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){ | |
| document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n</script\> \n'); |
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
| handleExternalLinks: function() { | |
| var hostName = window.location.hostname; | |
| var links = document.getElementsByTagName("a"); | |
| for(var i = 0; i < links.length; i++) { | |
| if(links[i].href.indexOf(hostName) == -1) { | |
| var curTitle = (links[i].getAttribute("title")) ? links[i].getAttribute("title") + " - ": ""; | |
| links[i].setAttribute("target", "_blank"); | |
| links[i].setAttribute("title", curTitle + "opens in new window"); | |
| } | |
| } |
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
| module MobileSite | |
| def self.included(base) | |
| base.class_eval do | |
| # Uncomment for JQM Integration | |
| #rescue_from ActionView::MissingTemplate, :with => :view_unavailable | |
| before_filter :set_mobile_preferences | |
| before_filter :redirect_to_mobile_if_applicable | |
| before_filter :set_mobile_view_path |
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
| # This file goes in config/initializers | |
| require 'bootstrap_form_builder' | |
| # Make this the default Form Builder. You can delete this if you don't want form_for to use | |
| # the bootstrap form builder by default | |
| ActionView::Base.default_form_builder = BootstrapFormBuilder::FormBuilder | |
| # Add in our FormHelper methods, so you can use bootstrap_form_for. | |
| ActionView::Base.send :include, BootstrapFormBuilder::FormHelper |
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
| ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
| html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe | |
| # add nokogiri gem to Gemfile | |
| elements = Nokogiri::HTML::DocumentFragment.parse(html_tag).css "label, input" | |
| elements.each do |e| | |
| if e.node_name.eql? 'label' | |
| html = %(<div class="clearfix error">#{e}</div>).html_safe | |
| elsif e.node_name.eql? 'input' | |
| if instance.error_message.kind_of?(Array) | |
| html = %(<div class="clearfix error">#{html_tag}<span class="help-inline"> #{instance.error_message.join(',')}</span></div>).html_safe |
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.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/ | |
| # added hackery to work around wordpress issues - Patrick Anderson ([email protected]) | |
| # clearly this could be cleaner, but it does work | |
| require 'rack' | |
| require 'rack-legacy' | |
| require 'rack-rewrite' | |
| # patch Php from rack-legacy to substitute the original request so | |
| # WP's redirect_canonical doesn't do an infinite redirect of / |
# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query string
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
| var Class = Object.create(null, { | |
| "new": { | |
| "value": function () { | |
| var result = Object.create(this, { | |
| "class": { | |
| "value": this | |
| } | |
| }); | |
| result.initialize.apply(result, arguments); | |
| return result; |
OlderNewer