Permalink
Browse files

Added common JS pattern examples

  • Loading branch information...
1 parent f7fd841 commit 1c4a81878ecd42e6344ba10daa56c6e49ffa85dc @dmohl committed May 29, 2012
Showing with 382 additions and 104 deletions.
  1. BIN Examples/FsCoffeeScriptjQueryUI/FsCoffeeScriptjQueryUIExample.suo
  2. +37 −0 ...feeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/FsCoffeeScriptjQueryUIExampleWeb.csproj
  3. +7 −0 ...ryUI/FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/Patterns/Class.coffee
  4. +17 −0 ...jQueryUI/FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/Patterns/Class.js
  5. +8 −0 ...UI/FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/Patterns/Command.coffee
  6. +16 −0 ...ueryUI/FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/Patterns/Command.js
  7. +11 −0 ...I/FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/Patterns/Strategy.coffee
  8. +10 −0 ...eryUI/FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/Patterns/Strategy.js
  9. +14 −0 ...FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/SlideDeck/SlideDeck.coffee
  10. +18 −0 ...yUI/FsCoffeeScriptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/Scripts/SlideDeck/SlideDeck.js
  11. BIN ...Example/FsCoffeeScriptjQueryUIExampleWeb/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  12. BIN ...ptjQueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/obj/Debug/TempPE/Scripts.Patterns.Class.js.dll
  13. BIN ...QueryUIExample/FsCoffeeScriptjQueryUIExampleWeb/obj/Debug/TempPE/Scripts.Patterns.Strategy.js.dll
  14. +1 −1 Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/BuildScriptCache/.crc
  15. BIN ...s/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/BuildScriptCache/1/56808d5a.dat
  16. +1 −1 Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/NamedArguments/.crc
  17. BIN ...les/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/NamedArguments/7/7d94b125.dat
  18. BIN ...QueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/PdbInfo/489b52b9da113729c5817f70a616e1f36609f619
  19. BIN ...QueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/PdbInfo/b0c7019bddee13d39d50a04eca2409474689f5da
  20. BIN Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/SymbolCache.bin
  21. +1 −1 Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/TagPrefixes/.crc
  22. BIN Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/TagPrefixes/6/63daa5f9.dat
  23. BIN Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/TagPrefixes/9/56261ebb.dat
  24. +1 −1 Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/TodoCache/.crc
  25. BIN Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/TodoCache/5/3742fc83.dat
  26. +1 −1 Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/WordIndex/.crc
  27. BIN Examples/FsCoffeeScriptjQueryUI/_ReSharper.FsCoffeeScriptjQueryUIExample/WordIndex/9/20718d8.dat
  28. BIN slides.zip
  29. +14 −0 slides/Deck.js/CoffeeScript-Good Bold and with Sugar/SlideDeck.coffee
  30. +18 −0 slides/Deck.js/CoffeeScript-Good Bold and with Sugar/SlideDeck.js
  31. +207 −86 slides/Deck.js/CoffeeScript-Good Bold and with Sugar/index.html
  32. +0 −13 slides/Deck.js/CoffeeScript-Good Bold and with Sugar/introduction.js
@@ -14,6 +14,7 @@
<AssemblyName>FsCoffeeScriptjQueryUIExampleWeb</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
+ <UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -111,6 +112,21 @@
<Content Include="Scripts\jquery.validate.min.js" />
<Content Include="Scripts\modernizr-1.7.js" />
<Content Include="Scripts\modernizr-1.7.min.js" />
+ <Content Include="Scripts\Patterns\Class.js">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Class.coffee</DependentUpon>
+ </Content>
+ <Content Include="Scripts\Patterns\Command.js">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Command.coffee</DependentUpon>
+ </Content>
+ <Content Include="Scripts\Patterns\Strategy.js">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Strategy.coffee</DependentUpon>
+ </Content>
<Content Include="Scripts\PictureManager\PictureManager.js">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -121,6 +137,11 @@
<DesignTime>True</DesignTime>
<DependentUpon>Portlets.coffee</DependentUpon>
</Content>
+ <Content Include="Scripts\SlideDeck\SlideDeck.js">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>SlideDeck.coffee</DependentUpon>
+ </Content>
<Content Include="Scripts\UserManager\UserManager.js">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -168,6 +189,18 @@
<Content Include="Views\PictureManager\Index.cshtml" />
</ItemGroup>
<ItemGroup>
+ <None Include="Scripts\Patterns\Class.coffee">
+ <Generator>CoffeeScriptGenerator</Generator>
+ <LastGenOutput>Class.js</LastGenOutput>
+ </None>
+ <None Include="Scripts\Patterns\Command.coffee">
+ <Generator>CoffeeScriptGenerator</Generator>
+ <LastGenOutput>Command.js</LastGenOutput>
+ </None>
+ <None Include="Scripts\Patterns\Strategy.coffee">
+ <Generator>CoffeeScriptGenerator</Generator>
+ <LastGenOutput>Strategy.js</LastGenOutput>
+ </None>
<None Include="Scripts\PictureManager\PictureManager.coffee">
<Generator>CoffeeScriptGenerator</Generator>
<LastGenOutput>PictureManager.js</LastGenOutput>
@@ -176,6 +209,10 @@
<Generator>CoffeeScriptGenerator</Generator>
<LastGenOutput>Portlets.js</LastGenOutput>
</None>
+ <None Include="Scripts\SlideDeck\SlideDeck.coffee">
+ <Generator>CoffeeScriptGenerator</Generator>
+ <LastGenOutput>SlideDeck.js</LastGenOutput>
+ </None>
<None Include="Scripts\UserManager\UserManager.coffee">
<Generator>CoffeeScriptGenerator</Generator>
<LastGenOutput>UserManager.js</LastGenOutput>
@@ -0,0 +1,7 @@
+class Dog
+ offset = 7
+ constructor: (@name, @age) ->
+ toString: -> "#{@name} is #{@age*offset} years old."
+
+emma = new Dog "Emma", 9
+console.log emma.toString()
@@ -0,0 +1,17 @@
+(function() {
+ var Dog, emma;
+ Dog = (function() {
+ var offset;
+ offset = 7;
+ function Dog(name, age) {
+ this.name = name;
+ this.age = age;
+ }
+ Dog.prototype.toString = function() {
+ return "" + this.name + " is " + (this.age * offset) + " years old.";
+ };
+ return Dog;
+ })();
+ emma = new Dog("Emma", 9);
+ console.log(emma.toString());
+}).call(this);
@@ -0,0 +1,8 @@
+jqxhr = $.ajax
+ url: "/"
+
+logMessages = ""
+
+jqxhr.success -> logMessages += "Success!\n"
+jqxhr.error -> logMessages += "Error!\n"
+jqxhr.complete -> logMessages += "Completed!\n"
@@ -0,0 +1,16 @@
+(function() {
+ var jqxhr, logMessages;
+ jqxhr = $.ajax({
+ url: "/"
+ });
+ logMessages = "";
+ jqxhr.success(function() {
+ return logMessages += "Success!\n";
+ });
+ jqxhr.error(function() {
+ return logMessages += "Error!\n";
+ });
+ jqxhr.complete(function() {
+ return logMessages += "Completed!\n";
+ });
+}).call(this);
@@ -0,0 +1,11 @@
+standardAlgorithm = 2 * 2
+customAlgorithm = 2 * 3
+
+applyAlgorithm = (someNumber, algorithm) ->
+ someNumber * algorithm
+
+console.log """Standard algorithm result is
+ #{applyAlgorithm 2, standardAlgorithm}"""
+
+console.log """Custom algorithm result is
+ #{applyAlgorithm 2, customAlgorithm}."""
@@ -0,0 +1,10 @@
+(function() {
+ var applyAlgorithm, customAlgorithm, standardAlgorithm;
+ standardAlgorithm = 2 * 2;
+ customAlgorithm = 2 * 3;
+ applyAlgorithm = function(someNumber, algorithm) {
+ return someNumber * algorithm;
+ };
+ console.log("Standard algorithm result is \n" + (applyAlgorithm(2, standardAlgorithm)));
+ console.log("Custom algorithm result is\n" + (applyAlgorithm(2, customAlgorithm)) + ".");
+}).call(this);
@@ -0,0 +1,14 @@
+$ = jQuery
+$ ->
+ $(".code-example").fancybox
+ 'titlePosition' : 'outside'
+ 'overlayColor' : '#000'
+ 'overlayOpacity' : 0.4
+
+ $.deck '.slide'
+
+ $('#style-themes').change ->
+ $('#style-theme-link').attr 'href', $(@).val()
+
+ $('#transition-themes').change ->
+ $('#transition-theme-link').attr 'href', $(@).val()
@@ -0,0 +1,18 @@
+(function() {
+ var $;
+ $ = jQuery;
+ $(function() {
+ $(".code-example").fancybox({
+ 'titlePosition': 'outside',
+ 'overlayColor': '#000',
+ 'overlayOpacity': 0.4
+ });
+ $.deck('.slide');
+ $('#style-themes').change(function() {
+ return $('#style-theme-link').attr('href', $(this).val());
+ });
+ return $('#transition-themes').change(function() {
+ return $('#transition-theme-link').attr('href', $(this).val());
+ });
+ });
+}).call(this);
View
Binary file not shown.
@@ -0,0 +1,14 @@
+$ = jQuery
+$ ->
+ $(".code-example").fancybox
+ 'titlePosition' : 'outside'
+ 'overlayColor' : '#000'
+ 'overlayOpacity' : 0.4
+
+ $.deck '.slide'
+
+ $('#style-themes').change ->
+ $('#style-theme-link').attr 'href', $(@).val()
+
+ $('#transition-themes').change ->
+ $('#transition-theme-link').attr 'href', $(@).val()
@@ -0,0 +1,18 @@
+(function() {
+ var $;
+ $ = jQuery;
+ $(function() {
+ $(".code-example").fancybox({
+ 'titlePosition': 'outside',
+ 'overlayColor': '#000',
+ 'overlayOpacity': 0.4
+ });
+ $.deck('.slide');
+ $('#style-themes').change(function() {
+ return $('#style-theme-link').attr('href', $(this).val());
+ });
+ return $('#transition-themes').change(function() {
+ return $('#transition-theme-link').attr('href', $(this).val());
+ });
+ });
+}).call(this);
Oops, something went wrong. Retry.

0 comments on commit 1c4a818

Please sign in to comment.