- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in any unit (ex: pixels)
- code snippets are in JavaScript
angleRad = angleDeg * Math.PI / 180;
defmodule Absinthe.Ecto.Resolution.Schema do | |
@moduledoc """ | |
This module provides helper functions to resolve a GraphQL query into `Ecto.Query`. | |
""" | |
import Absinthe.Resolution.Helpers | |
import Ecto.Query | |
alias Absinthe.Resolution | |
alias Absinthe.Blueprint.Document.Field | |
//: Playground - noun: a place where people can play | |
import Cocoa | |
import Darwin | |
func htons(value: CUnsignedShort) -> CUnsignedShort { | |
return (value << 8) + (value >> 8) | |
} | |
let INADDR_ANY = in_addr(s_addr: 0) |
//! An example demonstrating that glium has a problem using instancing when | |
//! the vertex buffer is a slice with a non-zero starting index. | |
//! | |
#[macro_use] extern crate glium; | |
use glium::{DisplayBuild, Surface}; | |
// Vertex Shader: | |
static VERTEX_SHADER_SRC: &'static str = r#" | |
#version 140 |
defmodule Config do | |
@moduledoc """ | |
This module handles fetching values from the config with some additional niceties | |
""" | |
@doc """ | |
Fetches a value from the config, or from the environment if {:system, "VAR"} | |
is provided. | |
An optional default value can be provided if desired. |
Code snippets for "Coordinators with Storyboards" blog post at http://www.apokrupto.com/blog-1/2016/3/17/coordinators-with
(* for OCaml <4.03.0 define: | |
type ('a, 'b) result = Ok of 'a | Error of 'b *) | |
module type MONAD = sig | |
type 'a t | |
val return : 'a -> 'a t | |
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t | |
end | |
module Id = struct |
# This demonstrates that, when using async/await, a crash in the task will crash the caller | |
defmodule Tasker do | |
def good(message) do | |
IO.puts message | |
end | |
def bad(message) do | |
IO.puts message | |
raise "I'm BAD!" | |
end |
$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769
Note the running on port
for epmd
itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:
$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
/*: | |
## Phone Words | |
Generate a collection of words that can be represented by a given phone number. If a phone number contains the digits `1` or `0` then split up the phone number and find the words for each of the substrings as long as each substring has more than one digit. Non-keypad characters can be ignored. Optionally, filter out words so that only dictionary words are present in the result. | |
╔═════╦═════╦═════╗ | |
║ 1 ║ 2 ║ 3 ║ | |
║ ║ abc ║ def ║ | |
╠═════╬═════╬═════╣ | |
║ 4 ║ 5 ║ 6 ║ |