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
// Poor's man html Validator. | |
// https://gist.github.com/orlando/6251395 | |
function validateHtml (htmlString) { | |
var htmlString, divElm, docFrag, docFragHtml; | |
htmlString = htmlString.replace(/ +/g, " ").toLowerCase(); | |
htmlString = htmlString.replace(/\s*\/\s*>/g, ">"); | |
divElm = document.createElement('div'); | |
docFrag = document.createDocumentFragment(); | |
docFrag.appendChild(divElm); | |
docFrag.querySelector('div').innerHTML = htmlString; |
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 teamboxChatSound = function teamboxChatSound () { | |
var ping, chatBody, observer, base64string, hidden, visibilityChange; | |
base64String = "data:audio/wav;base64,UklGRoAaAABXQVZFZm10IBAAAAABAAEAESsAABErAAABAAgAZGF0YVwaAAB9fICEg355en2ChYF8e35/fX59foKDfHd6gIODgHp4fX99fYCAgIF/f4F9dHSAkpiFZlNjj7OlcEpYjrKWXlODt6xmMkqa1rZeKk2l2adNMG7FzXkvQJjbul8mT7LcoUYmbs3NfDE7mdquTyVfwduSNyl/1cdsKEuw2pM2LYXdyWQeP6jmrEEhb9TRZhtEruyuOxlmzeKCIzOW4bpKHV7C444pKobdyl0bSq7koDYrftLIYR9LrOGkOiNvy9Z7JDmc3KlBInHR03EaOKXkrj8ZbNHUdx80oeS2TRVaxtqKLTCV2rRWIFzD2I0xK4vcxWUfTLbcmzophdnGayRIr92kRihvys5/NkGZ0KhXMWa6yYY+PYnKs208V6O/lVhEdK6xhVdVgqSXdFtqj52Ka1xzkpuKbV90jJWKbmV3i5WEamd8lp1/X196nqJ8XWSHqJdpVWuZsI5bTHKpsYBRVoq0nGJJaae7iExGfry3cT9TmMWcUj1stcSBQUOEyLVkN1amzZRJO3TAv3Q6RZTSqFY0X7XMhEFBhMq0ZzpTo8uVTz1yvb91OkmVzapWMV+wyotBPH/Gu2YyUp/PnUU2cr3IeDNFkNKyUSxfs9SJNTqAyb1gL1elz5ZBOXW4vnI8VpG+n1NHd6i0d0JckbOaWFCAoqRwRWudrJFUToWoo3dMapyljF5VhKWffFdmkaGTbl1+mpeAZ3GRmYhzbIOXj4BxdYuPgXh4iZOBc3SClY13cHaIlIR1c4CUkHdqc46ch2tkepibgWZjgZyWeGBuj5yLaV9+m5 |
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
require 'active_record' | |
require 'database_cleaner' | |
connection_info = YAML.load_file("config/database.yml")["test"] | |
ActiveRecord::Base.establish_connection(connection_info) | |
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :transaction | |
DatabaseCleaner.clean_with(:truncation) |
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 message = new MailMessage(); | |
message.To.Add("[email protected]"); | |
message.To.Add("[email protected]"); | |
message.From = new MailAddress("[email protected]"); | |
message.Subject = "Test"; | |
message.Body = "Test"; | |
var client = new SmtpClient("localhost", 25); |
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
auth = function(params) { | |
} | |
module.exports = auth |
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
# blog post: | |
# Before using this initializer, you must set up Cancan. First, add the gem to your Gemfile: | |
# | |
# gem 'cancan' | |
# | |
# Next, generate and edit an Ability class: | |
# | |
# rails generate cancan:ability | |
# |
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
f.inputs "Product images" do | |
f.has_many :assets do |p| | |
p.input :asset, :as => :file, :label => "Image",:hint => p.object.asset.nil? ? p.template.content_tag(:span, "No Image Yet") : p.template.image_tag(p.object.asset.url(:thumb)) | |
p.input :_destroy, :as=>:boolean, :required => false, :label => 'Remove image' | |
end | |
end | |
f.inputs "Product details" do | |
f.input :category, :label => "Category", :hint => "Select one category" | |
f.input :height |
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
module Session | |
def self.generate_timestamp | |
Time.now.strftime("%s") | |
end | |
def self.generate_nonce | |
rand(36**16).to_s(36) | |
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
#!/usr/bin/ruby | |
require 'rss' | |
#this assumes you have a cookies.txt with destroyallsoftware.com cookies... later ill add a signin method.. | |
class Link | |
attr_accessor :link,:title,:date | |
def initialize(link,title,date) | |
@link = link |
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
# File forked from github.com/kete/kete.. not my work | |
# what this does: | |
# * prepares google map accordingly for request type | |
# (form for baskets_controller#choose_type with empty map, display for index_page_controller#index, | |
# all other controllers#show, new, etc.) | |
# * adds view helpers for loading api js lib and initializing google map js and escaping js (i18n_js(key)) | |
# * adds helpers for ExtendedFieldsHelper editor (including geocoding address form) and display | |
# * validates extended field ftype for map or map with address | |
module GoogleMap |