Skip to content

Instantly share code, notes, and snippets.

View adamaig's full-sized avatar

Adam Ingram-Goble adamaig

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<title>JS Bin</title>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.5/redux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.0.6/react-redux.js"></script>
</head>
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<title>JS Bin</title>
<meta charset="utf-8">
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
<script src="https://wzrd.in/standalone/redux@latest"></script>
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
@adamaig
adamaig / _README.md
Created December 19, 2009 15:44 — forked from kneath/_README.md

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
class Tag < ActiveRecord::Base
belongs_to :taggable, :polymorphic => true
validates_uniqueness_of :tag, :scope => [:taggable_type, :taggable_id]
def self.tag_with(owner_object, *tags)
(tags - owner_object.tags.collect {|x| x.tag}).collect do |tag|
Tag.create( :taggable => owner_object, :tag => tag )
end
end
case params
when params["town_id"]: # do_something
when params["filter_id"]: # do_something
when params["search"]: # do_something
end