Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
#!/usr/bin/env ruby | |
# A quick and dirty implementation of an HTTP proxy server in Ruby | |
# because I did not want to install anything. | |
# | |
# Copyright (C) 2009-2014 Torsten Becker <torsten.becker@gmail.com> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, |
# app/models/page.rb | |
class Page < ActiveRecord::Base | |
extend FriendlyId | |
friendly_id :title, :use => [:slugged, :history] | |
end |
$(document).ready(function() { | |
// Support for AJAX loaded modal window. | |
// Focuses on first input textbox after it loads the window. | |
$('[data-toggle="modal"]').bind('click',function(e) { | |
e.preventDefault(); | |
var url = $(this).attr('href'); | |
if (url.indexOf('#') == 0) { | |
$('#response_modal').modal('open'); | |
} else { |
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL | |
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew | |
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers | |
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it | |
gem install bundler | |
# 1. Get edge Rails source (master branch) | |
git clone https://github.com/rails/rails.git |
module SimpleForm | |
class FormBuilder < ActionView::Helpers::FormBuilder | |
# tried to monkey patch without copy'n'pasting, broke associations | |
def input(attribute_name, options={}, &block) | |
options = @defaults.deep_dup.deep_merge(options) if @defaults | |
chosen = | |
if name = options[:wrapper] | |
name.respond_to?(:render) ? name : SimpleForm.wrapper(name) | |
else |
require 'date' | |
require 'benchmark' | |
n = 1_000_000 | |
start_date = Date.new(2012, 01, 01) | |
end_date = Date.new(2012, 03, 01) | |
act_date = Date.new(2012, 02, 01) | |
Benchmark.bm(10) do |x| | |
x.report('include?') do |
require 'singleton' | |
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code | |
# invoked during a single request. | |
# | |
# Example: | |
# | |
# 1) Make sure this file is loaded in an initializer | |
# | |
# 2) Add the following to your application.rb in Rails3: |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
defmodule Chain do | |
defmacro chain(ex) do | |
parse(ex) | |
end | |
defp parse({:., _, [first_arg, function_name]}, more_args) do | |
args = [first_arg|more_args] |> Enum.map(&parse/1) | |
apply(String, function_name, args) | |
end |
To colaborate on a gist:
git remote add-url cindy https://gist.github.com/cindy/df03bdacaef75a80f310
git fetch cindy/master
git merge cindy/master
git push origin/master