Open up Terminal.app in your /Applications/Utilities directory, then type in these commands, one after each other:
-
Create a temporary directory for cycript:
mkdir cycript && cd cycript -
Pull the latest cycript from cycript.org:
| =begin | |
| If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. | |
| If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? | |
| NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage. | |
| =end | |
| # "and" COUNTS! |
| import Either | |
| --main = asText (filterrr (\x -> x > 2) [1, 2, 3, 4]) | |
| main = asText (map squirtWithError [-2, -1, 0, 16, 36]) | |
| -- types | |
| data Option a = None | Some a |
| =begin | |
| Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are: | |
| 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ... | |
| It can be seen that P^4 + P^7 = 22 + 70 = 92 = P^8. | |
| However, their difference, 70 − 22 = 48, is not pentagonal. | |
| Find a pair of pentagonal numbers P^j and P^k, |
| class GuessTheNumber | |
| def play | |
| @nnn = 1.upto(100).to_a.sample | |
| # play game | |
| puts "Alright, I have a number in mind from 1-100. Pick a number." | |
| guess = gets.chomp | |
| puts "You said #{guess}." | |
| attempt guess | |
| end |
| textarea:focus, | |
| input[type="text"]:focus, | |
| input[type="password"]:focus, | |
| input[type="datetime"]:focus, | |
| input[type="datetime-local"]:focus, | |
| input[type="date"]:focus, | |
| input[type="month"]:focus, | |
| input[type="time"]:focus, | |
| input[type="week"]:focus, | |
| input[type="number"]:focus, |
| type Maybe a = Nothing | Just a | |
| type Option a = None | Some a | |
| type Result a = Failure | Success a | |
| max [] ----> Failure | |
| max [1,2,3] -----> Success 3 |
| function sum (numbers) { | |
| return !numbers.length ? 0 : numbers[0] + sum(numbers.slice(1)); | |
| }; |
| module Sinatra | |
| module Kittens | |
| module Helpers | |
| def kittens_page(x = 200..500, factor = 0.2) | |
| sample_method = RUBY_VERSION >= '1.9' ? :sample : :choice | |
| x = x.to_a.send(sample_method) | |
| y = ((x - factor*x).floor..(x + factor*x).ceil).to_a.send(sample_method) | |
| <<-HTML | |
| <!DOCTYPE html> |
| import Text (asText) | |
| type Collection a = Nada | Glue a (Collection a) | |
| summm xs = | |
| case xs of | |
| Nada -> 0 | |
| Glue face body -> face + (summm body) | |
| listToCollection collection = |