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
def calc_next_grid(grid) do | |
Enum.reduce(alive_plus_neighbors(grid), MapSet.new, fn({x, y}, grid2) -> | |
is_alive = MapSet.member?(grid, {x, y}) | |
num_neighbors = count_neighbors(grid, {x, y}) | |
if should_live?(is_alive, num_neighbors) do | |
MapSet.put(grid2, {x, y}) | |
else | |
grid2 | |
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
# /etc/hosts | |
# Ad servers | |
127.0.0.1 101com.com | |
127.0.0.1 101order.com | |
127.0.0.1 123found.com | |
127.0.0.1 180hits.de | |
127.0.0.1 180searchassistant.com | |
127.0.0.1 1x1rank.com |
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
#!/bin/bash | |
# Install Quake 3: Arena on a mac | |
# Copyright (c) 2016 simonewebdesign | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
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
// A snippet using GitHub's public API to get | |
// the URL and SHA of the first commit for a given repo | |
function openFirstCommit(userorg, repo, authToken) { | |
var opts = authToken ? | |
{ headers: new Headers({ | |
'Authorization': 'token ' + authToken | |
}) | |
} : {} |
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
#!/bin/bash | |
## | |
# This script creates a new release by reading from VERSION file. | |
## | |
set -e # Exit on error | |
set +x # Debug mode (-x on, +x off) | |
version="$(cat VERSION)" |
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
import Html exposing (text) | |
import String | |
main = | |
(String.filter (not << isSpace) "1023 49 85") | |
|> String.toInt | |
|> toString | |
|> text | |
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
@doc """ | |
Returns the sum of all elements. | |
Raises `ArithmeticError` if `enumerable` contains a non-numeric value. | |
## Examples | |
iex> Enum.sum([1, 2, 3]) | |
6 |
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
def to_sentence(list) do | |
list |> Enum.reverse |> Enum.reduce(fn(b,c) -> b <> ", " <> c end) | |
end | |
to_sentence ["foo", "bar", "baz"] == "foo, bar, baz" | |
# other cases, using Enum.map_join: | |
Enum.map_join(languages, ", ", fn(_) -> "_" 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
decodeSubmittedReportPayload : Json.Decoder SubmittedReportPayload | |
decodeSubmittedReportPayload = | |
Json.object1 | |
SubmittedReportPayload | |
("report" := decodeReportCredentials) | |
decodeInvalidReportPayload : Json.Decoder InvalidReportPayload | |
decodeInvalidReportPayload = | |
Json.object1 |