Skip to content

Commit

Permalink
add some stuff that I've been meaning to add for a long while...
Browse files Browse the repository at this point in the history
  • Loading branch information
Hong committed May 22, 2011
1 parent 8eea614 commit 8588ce9
Show file tree
Hide file tree
Showing 16 changed files with 582 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .bundle/config
@@ -1,2 +1,2 @@
---
BUNDLE_DISABLE_SHARED_GEMS: "1"
--- {}

Binary file modified .yardoc/objects/root.dat
Binary file not shown.
35 changes: 35 additions & 0 deletions Git.md
Expand Up @@ -3,3 +3,38 @@ General Rules

* Do not commit code without green tests
* Your commit message should be explicit and consistent with your committing code
* Remember MEMO: Merge Early, Merge Often

Where's the Remote?
---------------------------

* Do not rewrite history on anything that has been pushed to a remote--even if it's not on the master branch.

In particular, I'm speaking about the `git commit --amend/--squash` and `git rebase` commands. People
might have already fetched it and maybe even merged it to another of their local branches. Those people
might not know commit X was supposed to have been changed somehow, and when they pull again, it'll
either be a broken commit or end up reverting whatever change was made.


Good Defaults
-------------------

* Default entries for .gitignore

*.DS_Store
*~
.rvmrc
.bundle
Session.vim
*.swp


* Default entries for .gitignore for Rails

config/database.yml
log/
tmp/
coverage/
db/*.db
db/*.sqlite3
public/system/
45 changes: 45 additions & 0 deletions Javascript.md
@@ -0,0 +1,45 @@
General Formatting and Syntax
=====================

Don't really have a quick description right now, however, I recommend you learn how to utilize asynchronous events.

* Still in progress will update when I have time *

Formatting
---------------


Syntax and Usage
------------------------

* Avoid inline Javascript when possible. Hook to events using whatever Javascript framework you're using.

However, having script tags in your html templates is fine. Just don't do an inline on[*event] hook.


* Remember that returning false on a jQuery callback is not the same as returning false on an inline callback.

The main difference is that return false; on a jQuery callback executes event.preventDefault() and
event.stopPropagation() as well as returns out of the function. Returning false on an inline callback only
prevents the default.


* Use event.preventDefault() or event.stopPropagation() if you only need one of it.

event.preventDefault() stops whatever the default behavior of the element from executing (eg an anchor
redirecting). event.stopPropagation() stops event bubbling up into the parent elements.


Common Sense
--------------------

* Don't cram everything into one big javascript file if only certain pages require it.

Especially true if those certain pages are rarely accessed.







1 change: 1 addition & 0 deletions README.md
Expand Up @@ -18,6 +18,7 @@ Currently there are three sections to be planned
2. Design
3. Testing
4. Git
5. Javascript

Each section has its own file in Markdown format and will have their own guidelines and tips and tricks. Long standalone example code can be found in the 'examples' subdirectory.

Expand Down
25 changes: 16 additions & 9 deletions Ruby.md
Expand Up @@ -53,14 +53,14 @@ Formatting

* List methods in ascending alphabetical order

def a_method
end
def a_method
end

def b_method
end
def b_method
end

def xtrange_method
end
def xtrange_method
end

* The long-line limit is 80 characters

Expand All @@ -70,9 +70,9 @@ Formatting
* Trailing whitespace is useless, remove it.

* Put a space after a comma when listing elements
[a,b,c,g,h] should be [a, b, c, d]
{:a=>1,:b=>2,:c=>3} should be {:a => 1, :b => 2, :c => 3}

[a,b,c,g,h] should be [a, b, c, d]
{:a=>1,:b=>2,:c=>3} should be {:a => 1, :b => 2, :c => 3}

Syntax and Usage
------------------------
Expand Down Expand Up @@ -126,7 +126,14 @@ Common Sense
* Don't Repeat Yourself


Testing
-------------

* Starting with tests isn't what you want unless you know exactly how things work (and that it will work that way).

TDD and BDD tutorials neglect to mention a very crucial 0th step: the prototype. You have to have a working
prototype, otherwise the test is too general. It's going to be painful to have to keep rewriting the tests. Get your
prototype working--either in your head or as proofs of concept--and then write tests for the real thing.



Expand Down
14 changes: 10 additions & 4 deletions public/_index.html
Expand Up @@ -55,13 +55,19 @@ <h2>File Listing</h2>
<li class="r2"><a href="file.Git.html" title="Git">Git</a></li>


<li class="r1"><a href="file.Rails.html" title="Rails">Rails</a></li>
<li class="r1"><a href="file.Javascript.html" title="Javascript">Javascript</a></li>


<li class="r2"><a href="index.html" title="README">README</a></li>
<li class="r2"><a href="file.Rails.html" title="Rails">Rails</a></li>


<li class="r1"><a href="file.Ruby.html" title="Ruby">Ruby</a></li>
<li class="r1"><a href="index.html" title="README">README</a></li>


<li class="r2"><a href="file.Ruby.html" title="Ruby">Ruby</a></li>


<li class="r1"><a href="file.Scss.html" title="Scss">Scss</a></li>


</ul>
Expand All @@ -85,7 +91,7 @@ <h2>Namespace Listing A-Z</h2>
</div>

<div id="footer">
Generated on Fri Apr 1 16:53:25 2011 by
Generated on Sun May 22 00:23:30 2011 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.6.5 (ruby-1.8.7).
</div>
Expand Down
97 changes: 97 additions & 0 deletions public/file.Git.html
@@ -0,0 +1,97 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File: Git</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
relpath = '';
if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>

</head>
<body>
<script type="text/javascript" charset="utf-8">
if (window.top.frames.main) document.body.className = 'frames';
</script>

<div id="header">
<div id="menu">

<a href="_index.html" title="Index">Index</a> &raquo;
<span class="title">File: Git</span>


<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

<div id="search">
<a id="class_list_link" href="#">Class List</a>
<a id="method_list_link" href="#">Method List</a>
<a id ="file_list_link" href="#">File List</a>
</div>

<div class="clear"></div>
</div>

<iframe id="search_frame"></iframe>

<div id="content"><div id='filecontents'><h1>General Rules</h1>

<ul>
<li>Do not commit code without green tests</li>
<li>Your commit message should be explicit and consistent with your committing code</li>
<li>Remember MEMO: Merge Early, Merge Often</li>
</ul>


<h2>Where's the Remote?</h2>

<ul>
<li><p>Do not rewrite history on anything that has been pushed to a remote--even if it's not on the master branch.</p>

<p> In particular, I'm speaking about the <code>git commit --amend/--squash</code> and <code>git rebase</code> commands. People
might have already fetched it and maybe even merged it to another of their local branches. Those people
might not know commit X was supposed to have been changed somehow, and when they pull again, it'll
either be a broken commit or end up reverting whatever change was made.</p></li>
</ul>


<h2>Good Defaults</h2>

<ul>
<li><p>Default entries for .gitignore</p>

<pre class="code"> <span class='mult op'>*</span><span class='dot token'>.</span><span class='DS_Store constant id'>DS_Store</span>
<span class='mult op'>*</span><span class='bitnot op'>~</span>
<span class='dot token'>.</span><span class='rvmrc identifier id'>rvmrc</span>
<span class='dot token'>.</span><span class='bundle identifier id'>bundle</span>
<span class='Session constant id'>Session</span><span class='dot token'>.</span><span class='vim identifier id'>vim</span>
<span class='mult op'>*</span><span class='dot token'>.</span><span class='swp identifier id'>swp</span>
</pre></li>
<li><p>Default entries for .gitignore for Rails</p>

<pre class="code"> <span class='config identifier id'>config</span><span class='div op'>/</span><span class='database identifier id'>database</span><span class='dot token'>.</span><span class='yml identifier id'>yml</span>
<span class='log identifier id'>log</span><span class='div op'>/</span>
<span class='tmp identifier id'>tmp</span><span class='div op'>/</span>
<span class='coverage identifier id'>coverage</span><span class='div op'>/</span>
<span class='db identifier id'>db</span><span class='div op'>/</span><span class='mult op'>*</span><span class='dot token'>.</span><span class='db identifier id'>db</span>
<span class='db identifier id'>db</span><span class='div op'>/</span><span class='mult op'>*</span><span class='dot token'>.</span><span class='sqlite3 identifier id'>sqlite3</span>
<span class='public identifier id'>public</span><span class='div op'>/</span><span class='system identifier id'>system</span><span class='div op'>/</span>
</pre></li>
</ul>
</div></div>

<div id="footer">
Generated on Sun May 22 00:23:30 2011 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.6.5 (ruby-1.8.7).
</div>

</body>
</html>
89 changes: 89 additions & 0 deletions public/file.Javascript.html
@@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File: Javascript</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
relpath = '';
if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>

</head>
<body>
<script type="text/javascript" charset="utf-8">
if (window.top.frames.main) document.body.className = 'frames';
</script>

<div id="header">
<div id="menu">

<a href="_index.html" title="Index">Index</a> &raquo;
<span class="title">File: Javascript</span>


<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

<div id="search">
<a id="class_list_link" href="#">Class List</a>
<a id="method_list_link" href="#">Method List</a>
<a id ="file_list_link" href="#">File List</a>
</div>

<div class="clear"></div>
</div>

<iframe id="search_frame"></iframe>

<div id="content"><div id='filecontents'><h1>General Formatting and Syntax</h1>

<p>Don't really have a quick description right now, however, I recommend you learn how to utilize asynchronous events.</p>

<ul>
<li>Still in progress will update when I have time *</li>
</ul>


<h2>Formatting</h2>

<h2>Syntax and Usage</h2>

<ul>
<li><p>Avoid inline Javascript when possible. Hook to events using whatever Javascript framework you're using.</p>

<p> However, having script tags in your html templates is fine. Just don't do an inline on[*event] hook.</p></li>
<li><p>Remember that returning false on a jQuery callback is not the same as returning false on an inline callback.</p>

<p> The main difference is that return false; on a jQuery callback executes event.preventDefault() and
event.stopPropagation() as well as returns out of the function. Returning false on an inline callback only
prevents the default.</p></li>
<li><p>Use event.preventDefault() or event.stopPropagation() if you only need one of it.</p>

<p> event.preventDefault() stops whatever the default behavior of the element from executing (eg an anchor
redirecting). event.stopPropagation() stops event bubbling up into the parent elements.</p></li>
</ul>


<h2>Common Sense</h2>

<ul>
<li><p>Don't cram everything into one big javascript file if only certain pages require it.</p>

<p> Especially true if those certain pages are rarely accessed.</p></li>
</ul>
</div></div>

<div id="footer">
Generated on Sun May 22 00:23:30 2011 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.6.5 (ruby-1.8.7).
</div>

</body>
</html>
7 changes: 4 additions & 3 deletions public/file.README.html
Expand Up @@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File: README</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
Expand Down Expand Up @@ -59,6 +59,7 @@ <h2>Usage</h2>
<li>Design</li>
<li>Testing</li>
<li>Git</li>
<li>Javascript</li>
</ol>


Expand Down Expand Up @@ -97,9 +98,9 @@ <h2>License</h2>
THE SOFTWARE.</p></div></div>

<div id="footer">
Generated on Wed Dec 15 01:45:54 2010 by
Generated on Sun May 22 00:23:30 2011 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.6.3 (ruby-1.8.7).
0.6.5 (ruby-1.8.7).
</div>

</body>
Expand Down

0 comments on commit 8588ce9

Please sign in to comment.