An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
| import org.scalatest.FlatSpec | |
| class ScalaTestExampleSpec extends FlatSpec { | |
| trait Builder { | |
| val builder = new StringBuilder("ScalaTest is ") | |
| } | |
| "Testing" should "be productive" in new Builder { | |
| builder.append("productive!") |
| # Credit http://stackoverflow.com/a/2514279 | |
| for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r |
| id;title;description;google_product_category;link;image_link;condition;custom_label_1;custom_label_2;custom_label_3;custom_label_4;availability;price;brand;gtin;mpn;identifier_exists;gender;material;age_group;color;size;shipping(country:service:price);sale_price | |
| 111;" - Dylan blau in 30/34 | ARMEDANGELS";Bio Dylan blau für Herren aus 100% Baumwolle (bio) in 30/34. Faire Kleidung produziert aus nachhaltigen Materialien, vegan und GOTS zertifiziert.;1604;https://www.armedangels.de/dylan-451290.html#415=3343?redirection=no;;new;No;Spring Summer 2018;40;1;in stock;99.90EUR;ARMEDANGELS;4,25E+12;1,03E+13;TRUE;Herren;;adult;blau;30/34;DE:DHL:4.95 EUR;0 | |
| 222;Chino aus Bio-Baumwolle Mix - Brandon grün in 30/32 | ARMEDANGELS;Bio Chino aus Bio-Baumwolle Mix Brandon grün für Herren aus 100% Baumwolle (bio) in 30/32. Faire Kleidung produziert aus nachhaltigen Materialien, vegan und GOTS zertifiziert.;1604;https://www.armedangels.de/maennerbekleidung-hose-chino-solid-brandon-10251597-256.html#411=3268?redirecti |
| // http://stackoverflow.com/questions/8104846/chart-of-ienumerable-linq-equivalents-in-scala | |
| xs.Aggregate(accumFunc) -> xs.reduceLeft(accumFunc) | |
| xs.Aggregate(seed, accumFunc) -> xs.foldLeft(seed)(accumFunc) | |
| xs.Aggregate(seed, accumFunc, trans) -> trans(xs.foldLeft(seed)(accumFunc)) | |
| xs.All(pred) -> xs.forall(pred) | |
| xs.Any() -> xs.nonEmpty | |
| xs.Any(pred) -> xs.exists(pred) | |
| xs.AsEnumerable() -> xs.asTraversable // roughly | |
| xs.Average() -> xs.sum / xs.length |
| #!/bin/bash | |
| set -u | |
| # Clones and softlinks a git repo, _if needed_. | |
| # Summary of steps: | |
| # 1. Checks that the provided repo is valid (SSH or HTTP) | |
| # 2. Compares local and remote commit to see if there is a new version | |
| # 3. Clones the remote commit in local, adding -<timestamp>-<commit> to the folder name | |
| # 4. Deletes .git directory of the cloned repo |
| # Based on patent https://www.google.com/patents/US7251579 | |
| # Not responsible if you use this for anything other than personal use | |
| from math import sqrt | |
| def realfeel(W, #windspeed mph | |
| A, #pressure mb | |
| T, # temperature F | |
| UV, # UV Index | |
| D, # Dew Point F | |
| P2, # preciptation Factor from 0-5 |
any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
never is assignable to any, and any is assignable to anything at all.any & AnyTypeExpression = any, any | AnyTypeExpression = anyunknown: proper, well-behaved [top type]
unknown. unknown is only assignable to itself (unknown) and any.unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknownany whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.| //This implementation is a porting of naive continuation monad in Haskell in "All About Monads" pages. | |
| class Cont[R, +A](val runCont: (A => R) => R) { | |
| def map[B](f: A => B): Cont[R, B] = { | |
| new Cont[R, B](k => runCont(a => Cont.ret[R, B](f(a)).runCont(k))) | |
| } | |
| def flatMap[B](f: A => Cont[R, B]) :Cont[R, B] = { | |
| new Cont[R, B](k => runCont(a => f(a).runCont(k))) | |
| } | |
| } |