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 Todo.SuperVisor do | |
use Supervisor | |
def init(_) do | |
processes = [worker(Todo.Cache, [])] | |
supervise(processes, strategy: :one_for_one) | |
end | |
end |
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 KeyValueStore do | |
use GenServer | |
def init(_) do | |
{:ok, HashDict.new} | |
end | |
def handle_cast({:put, key, value}, state) do | |
{:noreply, HashDict.put(state, key, value)} | |
end |
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 KeyValueStore do | |
def start do | |
ServerProcess.start(KeyValueStore) | |
end | |
def put(pid, key, value) do | |
ServerProcess.call(pid, {:put, key, value}) | |
end | |
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
server = Server.start | |
Enum.each(1..5, fn(i) -> | |
spawn(fn -> | |
IO.puts "Sending msg ##{i}" | |
response = Server.send_msg(server, i) | |
IO.puts "Response: #{response}" | |
end) | |
end) |
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
Process.register(self, :some_name) | |
send(:some_name, :msg) | |
receive do | |
msg -> IO.puts "received #{msg}" | |
end |
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
{ | |
"name": "react-app", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"react": "^16.2.0", | |
"react-dom": "^16.2.0", | |
"react-scripts": "1.1.1" | |
}, | |
"scripts": { |
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
import App from './app/index'; | |
import CodePush from 'react-native-code-push'; | |
const app = CodePush({ | |
installMode: CodePush.InstallMode.IMMEDIATE, | |
updateDialog: true | |
})(App); |
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
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache |
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
public class AppConfig extends WebMvcConfigurerAdapter{ | |
@Bean | |
public MessageSource messageSource() { | |
ReloadableResourceBundleMessageSource bean = new ReloadableResourceBundleMessageSource(); | |
bean.setBasename("classpath:messages"); | |
bean.setDefaultEncoding("UTF-8"); | |
return bean; | |
} | |
@Bean |
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
from matplotlib import pyplot as plt | |
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] | |
gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3] | |
plt.plot(years, gdp, color='green', marker='o', linestyle='solid') | |
plt.title("Nominal GDP") | |
plt.ylabel("Billions of $") |