This file contains hidden or 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
| set -ex | |
| for branch in $(git branch -a | fgrep greenkeeper | gsed -r 's#^ *remotes/origin/##'); do | |
| git checkout $branch | |
| yarn install | |
| git add yarn.lock | |
| git commit -m 'Update yarn.lock.' | |
| git push | |
| git checkout master | |
| git branch -d $branch |
This file contains hidden or 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
| const all = promises => { | |
| if (promises.length === 0) | |
| return Promise.resolve([]) | |
| let [head, ...tail] = promises | |
| return head.then(h => | |
| all(tail).then(t => | |
| [h].concat(t))) | |
| } |
This file contains hidden or 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
| function getJSONP(address, callback) { | |
| const random = Math.floor(Math.random() * 65536) | |
| const callbackName = 'getJSONP_callback_' + random | |
| window[callbackName] = function() { | |
| document.body.removeChild(script) | |
| delete window[callbackName] | |
| callback.apply(null, arguments) | |
| } | |
| const script = document.createElement('script') |
This file contains hidden or 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
| -- Usage: | |
| -- rot 13 "Uryyb, jbeyq!" | |
| -- --> "Hello, world!" | |
| import Control.Applicative ((<|>)) | |
| import Data.Maybe (fromMaybe) | |
| import System.Environment (getArgs) | |
| caesarCipher :: Int -> [a] -> [(a, a)] | |
| caesarCipher n xs = zip xs (drop n (cycle xs)) |
This file contains hidden or 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
| FROM ruby | |
| RUN mkdir /app | |
| WORKDIR /app | |
| COPY Gemfile Gemfile | |
| RUN bundle install | |
| COPY google.rb google.rb | |
| RUN chmod +x google.rb |
This file contains hidden or 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
| import scala.language.higherKinds | |
| trait Exp[Visitor[_]] { | |
| def visit[R](visitor: Visitor[R]): R | |
| } | |
| trait VisitorF[R] { | |
| def forNum(n: Int): R | |
| } |
This file contains hidden or 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
| import scala.collection.SortedSet | |
| sealed trait Tree[T] { | |
| val value: T | |
| } | |
| case class Leaf[T](value: T) extends Tree[T] | |
| case class Node[T](value: T, children: SortedSet[Tree[T]]) extends Tree[T] | |
| object ClassHierarchy { | |
| def main(args: Array[String]) = |
This file contains hidden or 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
| $ foo=$(false); echo $? | |
| 1 | |
| $ export foo=$(false); echo $? | |
| 0 | |
| $ function bar { local foo=$(false); echo $?; }; bar | |
| 0 |
This file contains hidden or 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
| module BankAccount | |
| module Prod = | |
| type Result<'T> = | |
| | Success of 'T | |
| | Failure of string | |
| let (|>>) (result: Result<'T>) (f: 'T -> Result<'U>) = | |
| match result with | |
| | Success(value) -> f value | |
| | Failure(error) -> Failure(error) |