Skip to content

Instantly share code, notes, and snippets.

View paulohp's full-sized avatar
🐴
hacking listening to sertanejo.

Paulo Pires paulohp

🐴
hacking listening to sertanejo.
  • @national-nederlanden
  • Den Haag, NL
View GitHub Profile
module.exports = function flatten(nestedArrays) {
if (!Array.isArray(nestedArrays))
throw new Error("flatten() called with non-array");
function* f(nestedArrays) {
for (let element of nestedArrays)
if (Array.isArray(element)) yield* f(element);
else yield element;
}
return Array.from(f(nestedArrays));
}
import * as types from './actionsTypes';
import courseApi from '../api/mockCourseApi';
export function loadCoursesSucess(courses) {
return {
type: types.LOAD_COURSES_SUCCESS,
courses
};
}
defmodule Solution do
line = "10 12 50
20 20 10"
#line = IO.read :stdio, :all
[a1, a2, a3, b1, b2, b3] = String.split line
initial_points = %{alice: 0, bob: 0}
case 1 > 2 do
true -> %{map | value: 1++}
false -> %{map | value2: 2++}
end
defmodule Identicon do
def main(input) do
input
|> hash_input
|> pick_color
|> build_grid
|> filter_odd_squares
|> build_pixel_map
end
defmodule Identicon.Image do
defstruct hex: nil, color: nil, grid: nil
end
defmodule Identicon do
def main(input) do
input
|> hash_input
|> pick_color
|> build_grid
end
def build_grid(%Identicon.Image{hex: hex} = image) do
grid =
defmodule Cards do
def create_deck do
values = ["Ace", "Two", "Three"]
suits = ["Spades", "Clubs", "Hearts", "Diamonds"]
for value <- values, suit <- suits do
"#{value} of #{suit}"
end
end
body {
background-color: #000;
color: #fff;
font-family: 'Open Sans','Helvetica Neue',helvetica,sans-serif;
font-size: 16px;
font-weight: normal;
height: 100%;
letter-spacing: 0;
margin: 0 auto 100px auto;
min-height: 500px;
@paulohp
paulohp / app.js
Created March 22, 2016 21:53
paulo's react-starter-kit
class App extends React.Component {
constructor(props) {
super(props)
this.state = {
items: []
}
}
componentDidMount() {