-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
144 lines (124 loc) · 13 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en_us' xml:lang='en_us' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Code Wiki</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link charset='utf-8' href='css/boilerplate/screen.css' media='screen' rel='stylesheet' type='text/css' />
<link charset='utf-8' href='css/boilerplate/print.css' media='print' rel='stylesheet' type='text/css' />
<!--[if lte IE 6]>
<link charset='utf-8' href='css/boilerplate/lib/ie.css' media='screen' rel='stylesheet' type='text/css' />
<![endif]-->
<link charset='utf-8' href='css/main.css' media='screen' rel='stylesheet' type='text/css' />
<link charset='utf-8' href='css/code_themes/coderay.css' media='screen, print' rel='stylesheet' type='text/css' />
<link charset='utf-8' href='css/code_themes/twilight.css' media='screen, print' rel='stylesheet' type='text/css' />
</head>
<body>
<div class='wrapper'>
<div class='header'></div>
<div class='content'>
<h1>Newton’s Reference</h1>
<h3><a href="http://webby.rubyforge.org">Webby</a> and git might be a match made in heaven!</h3>
<h2>Code Ray</h2>
<div class="CodeRay"><pre> <span class="r">module</span> <span class="cl">Flip</span>; <span class="gv">$KCODE</span> = <span class="s"><span class="dl">"</span><span class="k">u</span><span class="dl">"</span></span>
<span class="co">FLIP_MAP</span> = <span class="co">Hash</span>.new{|h,k| k}
{ <span class="s"><span class="dl">'</span><span class="k">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz</span><span class="dl">'</span></span> =>
<span class="s"><span class="dl">'</span><span class="k">∀ᗺↃᗡƎℲ⅁HIᒋʞ⅂ƜNOdԾᖈS⊥ႶΛMX⅄Zɐqɔpǝɟɓɥᴉʞ│ɯuodbɹsʇnʌʍxʎz</span><span class="dl">'</span></span>,
<span class="s"><span class="dl">'</span><span class="k">123456890~!@$%^&*()_+{}:|<>?"#`[],./-=</span><span class="ch">\\</span><span class="dl">'</span></span> =>
<span class="s"><span class="dl">'</span><span class="k">|ᘔᗴhᔕ9860~¡Ꭷ$%⋁⅋*)(‾+}{:|><¿„#ˎ][‘˙/-=</span><span class="ch">\\</span><span class="dl">'</span></span>
}.each {|from,to| from.split(<span class="rx"><span class="dl">/</span><span class="dl">/</span></span>).zip(to.split(<span class="rx"><span class="dl">/</span><span class="dl">/</span></span>)).each {|f,t| <span class="co">FLIP_MAP</span>[f]=t }}
<span class="co">FLIP_MAP</span>.merge!(<span class="s"><span class="dl">"</span><span class="k">'</span><span class="dl">"</span></span>=><span class="s"><span class="dl">'</span><span class="k">,</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">7</span><span class="dl">'</span></span>=><span class="s"><span class="dl">'</span><span class="k">/̲</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">j</span><span class="dl">'</span></span>=><span class="s"><span class="dl">'</span><span class="k">⌠̣</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">;</span><span class="dl">'</span></span>=><span class="s"><span class="dl">'</span><span class="k">:́</span><span class="dl">'</span></span>)
<span class="r">def</span> <span class="fu">flip</span>
<span class="co">FLIP_MAP</span>.values_at(* split(<span class="rx"><span class="dl">/</span><span class="dl">/</span></span>)).join
<span class="r">end</span>
<span class="r">end</span>
<span class="r">class</span> <span class="cl">String</span>
include <span class="co">Flip</span>
<span class="r">end</span>
<span class="s"><span class="dl">'</span><span class="k">:)</span><span class="dl">'</span></span>.flip <span class="c"># ":("</span>
</pre></div><h2>Ultraviolet</h2>
<div class="UltraViolet"><pre class="twilight"> <span class="Keyword">module</span> <span class="Entity">Flip</span>; <span class="Variable"><span class="Variable">$</span>KCODE</span> <span class="Keyword">=</span> <span class="String"><span class="String">"</span>u<span class="String">"</span></span>
<span class="Variable">FLIP_MAP</span> <span class="Keyword">=</span> <span class="Support">Hash</span>.<span class="Entity">new</span>{|<span class="Variable">h</span>,<span class="Variable">k</span>| k}
{ <span class="String"><span class="String">'</span>ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz<span class="String">'</span></span> =>
<span class="String"><span class="String">'</span>∀ᗺↃᗡƎℲ⅁HIᒋʞ⅂ƜNOdԾᖈS⊥ႶΛMX⅄Zɐqɔpǝɟɓɥᴉʞ│ɯuodbɹsʇnʌʍxʎz<span class="String">'</span></span>,
<span class="String"><span class="String">'</span>123456890~!@$%^&*()_+{}:|<>?"#`[],./-=<span class="StringConstant">\\</span><span class="String">'</span></span> =>
<span class="String"><span class="String">'</span>|ᘔᗴhᔕ9860~¡Ꭷ$%⋁⅋*)(‾+}{:|><¿„#ˎ][‘˙/-=<span class="StringConstant">\\</span><span class="String">'</span></span>
}.<span class="Entity">each</span> {|<span class="Variable">from</span>,<span class="Variable">to</span>| from.<span class="Entity">split</span>(<span class="StringRegexp"><span class="StringRegexp">/</span></span><span class="StringRegexp"></span><span class="StringRegexp"><span class="StringRegexp">/</span></span>).<span class="Entity">zip</span>(to.<span class="Entity">split</span>(<span class="StringRegexp"><span class="StringRegexp">/</span></span><span class="StringRegexp"></span><span class="StringRegexp"><span class="StringRegexp">/</span></span>)).<span class="Entity">each</span> {|<span class="Variable">f</span>,<span class="Variable">t</span>| <span class="Variable">FLIP_MAP</span>[f]<span class="Keyword">=</span>t }}
<span class="Variable">FLIP_MAP</span>.<span class="Entity">merge!</span>(<span class="String"><span class="String">"</span>'<span class="String">"</span></span>=><span class="String"><span class="String">'</span>,<span class="String">'</span></span>, <span class="String"><span class="String">'</span>7<span class="String">'</span></span>=><span class="String"><span class="String">'</span>/̲<span class="String">'</span></span>, <span class="String"><span class="String">'</span>j<span class="String">'</span></span>=><span class="String"><span class="String">'</span>⌠̣<span class="String">'</span></span>, <span class="String"><span class="String">'</span>;<span class="String">'</span></span>=><span class="String"><span class="String">'</span>:́<span class="String">'</span></span>)
<span class="Keyword">def</span> <span class="Entity">flip</span>
<span class="Variable">FLIP_MAP</span>.<span class="Entity">values_at</span>(<span class="Keyword">*</span> <span class="Entity">split</span>(<span class="StringRegexp"><span class="StringRegexp">/</span></span><span class="StringRegexp"></span><span class="StringRegexp"><span class="StringRegexp">/</span></span>)).<span class="Entity">join</span>
<span class="Keyword">end</span>
<span class="Keyword">end</span>
<span class="Keyword">class</span> <span class="Entity">String</span>
<span class="Keyword">include</span> <span class="Variable">Flips</span>
<span class="Keyword">end</span>
<span class="String"><span class="String">'</span>:)<span class="String">'</span></span>.<span class="Entity">flip</span> <span class="Comment"><span class="Comment">#</span> ":("</span>
</pre></div><h2>Graphviz</h2>
<h3>Directed Graphs</h3>
<img src="/images/abc.png" /><h4>code:</h4>
<div class="UltraViolet"><pre class="twilight"> <span class="Storage">digraph</span> abc {
a -> b -> c
a -> c
}
</pre></div><img src="/images/G.png" /><h4>code:</h4>
<div class="UltraViolet"><pre class="twilight"> <span class="Storage">digraph</span> G {
<span class="SupportConstant">compound</span>=true;
<span class="Storage">subgraph</span> cluster0 {
a -> b;
a -> c;
b -> d;
c -> d;
}
<span class="Storage">subgraph</span> cluster1 {
e -> g;
e -> f;
}
b -> f [<span class="SupportConstant">lhead</span>=cluster1];
d -> e;
c -> g [<span class="SupportConstant">ltail</span>=cluster0,
<span class="SupportConstant">lhead</span>=cluster1];
c -> e [<span class="SupportConstant">ltail</span>=cluster0];
d -> h;
}
</pre></div><h3>Struct</h3>
<img src="/images/structs.png" /><h4>code:</h4>
<div class="UltraViolet"><pre class="twilight"> <span class="Storage">digraph</span> structs {
<span class="Storage">node</span> [<span class="SupportConstant">shape</span>=record];
struct1 [<span class="SupportConstant">shape</span>=record,<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span><f0> left|<f1> middle|<f2> right<span class="String">"</span></span>];
struct2 [<span class="SupportConstant">shape</span>=record,<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span><f0> one|<f1> two<span class="String">"</span></span>];
struct3 [<span class="SupportConstant">shape</span>=record,<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>hello<span class="StringConstant">\n</span>world |{ b |{c|<here> d|e}| f}| g | h<span class="String">"</span></span>];
struct1:f1 -> struct2:f0;
struct1:f2 -> struct3:here;
}
</pre></div><h3>Entity-Relation Map</h3>
<img src="/images/ER.png" /><h4>code:</h4>
<div class="UltraViolet"><pre class="twilight"> <span class="Storage">graph</span> ER {
<span class="Storage">node</span> [<span class="SupportConstant">shape</span>=box]; course; institute; student;
<span class="Storage">node</span> [<span class="SupportConstant">shape</span>=ellipse]; {<span class="Storage">node</span> [<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>name<span class="String">"</span></span>] name0; name1; name2;}
code; grade; number;
<span class="Storage">node</span> [<span class="SupportConstant">shape</span>=diamond,<span class="SupportConstant">style</span>=filled,<span class="SupportConstant">color</span>=lightgrey]; <span class="String"><span class="String">"</span>C-I<span class="String">"</span></span>; <span class="String"><span class="String">"</span>S-C<span class="String">"</span></span>; <span class="String"><span class="String">"</span>S-I<span class="String">"</span></span>;
name0 -- course;
code -- course;
course -- <span class="String"><span class="String">"</span>C-I<span class="String">"</span></span> [<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>n<span class="String">"</span></span>,len=1.00];
<span class="String"><span class="String">"</span>C-I<span class="String">"</span></span> -- institute [<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>1<span class="String">"</span></span>,len=1.00];
institute -- name1;
institute -- <span class="String"><span class="String">"</span>S-I<span class="String">"</span></span> [<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>1<span class="String">"</span></span>,len=1.00];
<span class="String"><span class="String">"</span>S-I<span class="String">"</span></span> -- student [<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>n<span class="String">"</span></span>,len=1.00];
student -- grade;
student -- name2;
student -- number;
student -- <span class="String"><span class="String">"</span>S-C<span class="String">"</span></span> [<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>m<span class="String">"</span></span>,len=1.00];
<span class="String"><span class="String">"</span>S-C<span class="String">"</span></span> -- course [<span class="SupportConstant">label</span>=<span class="String"><span class="String">"</span>n<span class="String">"</span></span>,len=1.00];
<span class="SupportConstant">label</span> = <span class="String"><span class="String">"</span>Entity Relation Diagram<span class="String">"</span></span>;
<span class="SupportConstant">fontsize</span>=20;
}
</pre></div><p><a href="http://github.com/newtonapple/newtonapple.github.com/tree/master">Source</a></p>
</div>
<div class='footer'>
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/">
<img alt="Creative Commons License" style="border-width:0" src="http://creativecommons.org/images/public/somerights20.png" />
</a>
</div>
</div>
</body>
</html>