Install entr:
Add this to .bashrc
elixir_test() {
if [[ $# -eq 0 ]] ; then
find . -name '*.ex' -o \
Install entr:
Add this to .bashrc
elixir_test() {
if [[ $# -eq 0 ]] ; then
find . -name '*.ex' -o \
Controlling the keyboard led lights on a Macbook Pro running linux is harder than it should be. | |
For ...reasons the bundled `kbdlight` doesn't work, so we're left with no option but to roll | |
up our sleaves and get our hands dirty. Fortunately various bash commands and `bc` makes this | |
task pretty trivial so here is a script to control the brightness. | |
This script supports the following api: | |
$ kbdlight -set 10 | |
$ kbdlight -set +10 |
Controlling the screen brightness on a Macbook Pro running linux is harder than it should be. | |
For ...reasons the bundled `xbacklight` doesn't work, so we're left with no option but to roll | |
up our sleaves and get our hands dirty. Fortunately various bash commands and `bc` makes this | |
task pretty trivial so here is a script to control the brightness. | |
This script supports the following api: | |
$ brightness -set 10 | |
$ brightness -set +10 |
import React, { Component } from "react"; | |
import { connect } from "react-redux"; | |
import MessageList from "../components/MessageList"; | |
import MessageInput from "../components/MessageInput"; | |
import Actions from "../actions"; | |
function App(props) { | |
const { messages, sendMessage } = props; | |
return ( |
defmodule MasterProxy.Application do | |
@moduledoc """ | |
Custom Cowboy specification to support hosting multiple Phoenix apps within the same umbrella, | |
all served via the same port. This is only really necessary if you're deploying your umbrella | |
to a restricted hosting environment like Heroku where they only expose 1 port per dyno. | |
Don't for get to configure your endpoints, something like this should work: | |
config :myapp_web, MyAppWeb.Endpoint, | |
url: [scheme: "https", host: "myapp.herokuapp.com", port: 443], |
defmodule PyramidCalculator do | |
@doc """ | |
iex> PyramidCalculator.pyramid_prices_percents([1, 2, 3], 10) | |
[10.0, 33.33333333333333, 56.666666666666664] | |
iex> PyramidCalculator.pyramid_prices_percents([1, 2, 3], 40) | |
[40.0, 33.333333333333336, 26.666666666666668] | |
iex> PyramidCalculator.pyramid_prices_percents([1, 3, 7, 22], 5) | |
[5.0, 10.517241379310345, 21.551724137931036, 62.93103448275862] | |
""" |
// const Box = x => | |
// ({ | |
// map: f => Box(f(x)), | |
// fold: f => f(x), | |
// inspect: () => `Box(${x})` | |
// }) | |
const fmap = f => xs => xs.map(x => f(x)) |
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
#!/usr/bin/env bash | |
# Original Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/ | |
## Usage: heroku_env_copy [options] SOURCE TARGET | |
## | |
## NOTE: This script will only output the command, you should run it yourself. | |
## | |
## Options: | |
## -h, --help Display this message. | |
## |
# frozen_string_literal: true | |
class Things < ApplicationRecord | |
scope :filter_after_date, -> (date) { | |
where(created_at_as_date.gteq(date)) | |
} | |
scope :filter_before_date, -> (date) { | |
where(created_at_as_date.lteq(date)) | |
} | |
def self.created_at_as_date | |
Arel::Nodes::NamedFunction.new "DATE", [ arel_table[:created_at] ] |