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
defmodule Adventof.Day1 do | |
defp direction("R", :north), do: :east | |
defp direction("R", :east), do: :south |
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
# Elixir in 5 minutes | |
# To run this script, do elixir processes.exs | |
# Comments are made with the pound sign | |
# Strings are standard double quotes "" | |
# To write to the CLI you can use IO.puts or IO.write | |
IO.puts "Hello, world" |
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
# Install elixir raspberry pi, from http://suranyami.com/post/80056047551/installing-elixir-on-raspberry-pi | |
# Add the new repo | |
sudo echo 'deb http://packages.erlang-solutions.com/debian wheezy contrib' >> /etc/apt/sources.list | |
# Get the key | |
wget http://packages.erlang-solutions.com/debian/erlang_solutions.asc | |
sudo apt-key add erlang_solutions.asc && rm erlang_solutions.asc | |
# Get erlang |
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
pi <- read.csv("./pi.csv", header=FALSE, sep=" ") | |
dig <- 14000 | |
pistr <- paste(c(pi[1,]$V2, ".", head(pi[-1,], dig-1)$V2), collapse="") | |
is.palindrome <- function (word) { identical(word, paste(rev(strsplit(word, "")[[1]]), collapse="")) } | |
is.prime <- function(n) n == 2L || all(n %% 2L:floor(sqrt(n)) != 0) | |
base <- 1 |
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
if ("false" == true) echo "true\n"; | |
// => true | |
if ("false" == false) echo "true\n"; | |
// => false | |
if ("false" == 0) echo "true\n"; | |
// => true, wtf | |
if (false == 0) echo "true\n"; |
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
exports.randeats = function(req, res){ | |
var key = req.query.key; | |
var location = encodeURIComponent(req.query.location); | |
var radius = 16000; | |
var sensor = false; | |
var types = "restaurant"; | |
var keyword = "fast"; | |
var https = require('https'); | |
var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?" + "key=" + key + "&location=" + location + "&radius=" + radius + "&sensor=" + sensor + "&types=" + types + "&keyword=" + keyword; |
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
var http = require('http'); | |
var server = http.createServer( function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end("Hello, World!"); | |
}).listen(process.env port || 11111); | |
console.log("Server listening on port: " + server.address().port); |