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
defmodule EctoHelper do | |
@moduledoc """ | |
Provides helper functions | |
""" | |
@doc """ | |
Prettifies changeset error messages. | |
By default `changeset.errors` returns errors as keyword list, where key is name of the field | |
and value is part of message. For example, `[body: "is required"]`. | |
This method transforms errors in list which is ready to pass it, for example, in response of |
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
#include <SoftwareSerial.h> | |
#define ledPin 7 | |
SoftwareSerial mySerial(2, 3); | |
int val; | |
void setup() { | |
pinMode(ledPin, OUTPUT); |
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
#include <SoftwareSerial.h> | |
SoftwareSerial mySerial(2, 3); // RX, TX | |
int i = 0; | |
void setup() { | |
mySerial.begin(9600); | |
Serial.begin(9600); | |
} |
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
package com.mycompany.cms2components.data; | |
public class ItemOption { | |
private Integer id; | |
private String title; | |
private String description; | |
private String thumbUrl; | |
public ItemOption() | |
{ |
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 | |
PROJECT_NAME="article" | |
# Check if a session with a such name already exists | |
tmux has-session -t $PROJECT_NAME | |
# If session does not exists | |
if [ $? != 0 ] | |
then |
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
" Disable Arrow keys in Escape mode | |
map <up> <nop> | |
map <down> <nop> | |
map <left> <nop> | |
map <right> <nop> | |
" Disable Arrow keys in Insert mode | |
imap <up> <nop> | |
imap <down> <nop> | |
imap <left> <nop> |
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
function install_mix_dependencies() { | |
echo "Starting installing MIX dependencies..." | |
docker run \ | |
--rm --memory="512M" \ | |
-w="/app" \ | |
-v $PWD:/app \ | |
-e MIX_ENV=prod \ | |
--entrypoint=/app/docker/mix_deps_install.sh \ | |
elixir:1.3.2 | |
} |
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
require "net/https" | |
require "uri" | |
crt = File.read("client-2048.crt") | |
key = File.read("client-2048.key") | |
app_key = "YOUR_APP_KEY" | |
username = "YOUR_USERNAME" | |
password = "YOUR_PASSWORD" |
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
defmodule DynamicProcesses.Examples do | |
alias DynamicProcesses.{SomeSupervisor, SomeWorker} | |
import Supervisor.Spec | |
def add_single_supervisor(id \\ "1") do | |
{:ok, supervisor_spec} = build_supervisor_spec(SomeSupervisor, [], id) | |
Supervisor.start_child(DynamicProcesses.Supervisor, supervisor_spec) | |
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
defmodule DynamicProcesses do | |
use Application | |
def start(_type, _args) do | |
import Supervisor.Spec, warn: false | |
children = [ | |
] | |
opts = [strategy: :one_for_one, name: DynamicProcesses.Supervisor] |
NewerOlder