This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I add a link "(.*?)" replacing "(.*?)" content with "(.*?)"$/ do |link_name, element_selector, new_content| | |
page.execute_script(" | |
var link_element = document.createElement('a'); | |
link_element.setAttribute('onclick','jQuery(\\'#{element_selector}\\')[0].innerHTML = \\'#{new_content}\\''); | |
link_element.setAttribute('href', '#'); | |
link_element.innerHTML = '#{link_name}'; | |
jQuery('body')[0].appendChild(lLinkElement); | |
") | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in my ArrayController | |
actions: { | |
create: function() { | |
var person = this.get('controllers.person.content'); | |
var name = this.get('newName'); | |
if (name && !name.trim()) { | |
this.set('newName', ''); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type RGB = | |
| Red of byte | |
| Green of byte | |
| Blue of byte | |
let (|TheRed|_|) = function | |
| Red x -> Some x | |
| _ -> None | |
let xs = [Red 42uy; Green 0uy; Blue 0uy] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type cell = A | B | |
type 'cell U = U of 'cell LazyList * 'cell * LazyList<'cell> | |
module Universe = | |
open LazyList | |
let U left focus right = U (left, focus, right) | |
let initial () = U (repeat A) B (repeat A) | |
let shiftRight = fun (U (left,focus,Cons(focus',right))) -> U (cons focus left) focus' right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
#r @"E:\Assemblies\OpenTK\OpenTK.dll" | |
open System | |
open System.Drawing | |
open System.Collections.Generic | |
open OpenTK | |
open OpenTK.Graphics | |
open OpenTK.Graphics.OpenGL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
(* original sample data.. search/replaced symbols from python | |
dictionary of dictionaries *) | |
let criticsList = [ | |
"Lisa Rose", [ | |
"Lady in the Water", 2.5; "Snakes on a Plane", 3.5; | |
"Just My Luck", 3.0; "Superman Returns", 3.5; | |
"You; Me and Dupree", 2.5; "The Night Listener", 3.0 | |
]; | |
"Gene Seymour", [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Learn more about F# at http://fsharp.net | |
namespace BasicConcepts | |
module Algorithms = | |
let ``1.1E`` (m : uint32) (n : uint32) = | |
let rec aux m n l = | |
let r = m % n | |
if r <> 0u then aux n r (r :: l) else l | |
aux m n [] |> Seq.head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#time | |
(fun _ -> | |
let initial = | |
seq { for x = 0 to 100 do | |
for y = 0 to 100 do | |
if (1 < x) && (x < y) && ((x + y) < 100) then | |
yield (x,y) } | |
Seq.iter (fun _ -> ()) initial | |
)() |
OlderNewer