Skip to content

Instantly share code, notes, and snippets.

View nalanj's full-sized avatar
🌴
On vacation

nalanj nalanj

🌴
On vacation
View GitHub Profile
@nalanj
nalanj / index.html
Created March 5, 2012 18:52
HTML Tables Challenge
<!DOCTYPE html>\n<html lang=\"en\">
<head>
<title> Table Challenge</title>
</head>
<body>
<h1> HTML Table Challenge</h1>
<!-- Write your code below -->
</body>
</html>
@nalanj
nalanj / .tconsole
Created March 2, 2012 13:14
TConsole: Add a custom file set
TConsole::Config.run do |config|
config.file_sets["helpers"] = ["test/helpers/**/*_test.rb"]
end
@nalanj
nalanj / .tconsole
Created March 2, 2012 04:16
Config to force rails to clear connections in our base environment.
TConsole::Config.run do |config|
config.preload_paths = ["./config/application"]
config.include_paths = ["./test"]
config.file_sets = {
"all" => ["#{config.test_dir}/unit/**/*_test.rb", "#{config.test_dir}/functional/**/*_test.rb",
"#{config.test_dir}/integration/**/*_test.rb"],
"units" => ["#{config.test_dir}/unit/**/*_test.rb"],
"unit" => ["#{config.test_dir}/unit/**/*_test.rb"],
"functionals" => ["#{config.test_dir}/functional/**/*_test.rb"],
"functional" => ["#{config.test_dir}/functional/**/*_test.rb"],
@nalanj
nalanj / textselection.js
Created February 3, 2012 13:55
Class for disabling and re-enabling text selection across the entire document
var TextSelection;
TextSelection = (function() {
function TextSelection() {}
TextSelection.returnFalse = function() {
return false;
};
def form_div(form, field, message = nil, options = {}, &block)
style_class = options[:class] || ""
style_class += " error" if form.object.errors[field].any?
div_options = {}
div_options[:class] = style_class unless style_class.blank?
buffer = ""
buffer << content_tag("div", div_options) do
inner_buffer = yield
class FTestHelper
def self.execute_tests(*paths)
paths.each do |path|
FileList[path].to_a.each { |file| require File.expand_path(file) }
end
end
end
namespace :ftest do
@nalanj
nalanj / example.html
Created May 26, 2011 18:20
Tracking Click Events for Downloads
<html>
<body>
<a id="download-link" href="download.pdf">Download!</a>
<script type="text/javascript">
$('#download-link').click() {
_gaq.push(['_trackEvent', 'Downloads', 'Downloaded', 'download.pdf');
}
</script>
</body>
@nalanj
nalanj / heroku_cron.rb
Created May 7, 2011 02:33
How to set up cron for a particular time on Heroku
# Heroku only lets you run cron jobs at the specific time that you add cron to your app, so here's a quick script that I used
# to make that happen.
until Time.now.hour == 3 && Time.now.min == 30
puts "Still not time..."
sleep 60
end
system("heroku addons:add cron")
// considering this data
var hash = { person: { name: "Yehuda" } }
what's the value of .. in this template?
{{#person/name}}{{..}}{{/person/name}}
Is it person or is it the whole hash?
@nalanj
nalanj / bind_helper?
Created November 17, 2010 01:06
We can't wrap name in a span, since it's inside of a tag.
<html>
<body>
<form>
{{#bind name}}<input type="text" value="{{.}}" />{{/bind}}
</form>
</body>
</html>