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
| test/ecto/changeset/embedded_test.exs:381: warning: variable changeset is unused | |
| test/ecto/changeset/embedded_test.exs:386: warning: variable changeset is unused | |
| test/ecto/changeset/embedded_test.exs:392: warning: variable changeset is unused | |
| test/ecto/changeset/embedded_test.exs:396: warning: variable changeset is unused | |
| test/ecto/changeset/embedded_test.exs:468: warning: variable changeset is unused | |
| test/ecto/changeset/embedded_test.exs:473: warning: variable new_changeset is unused | |
| test/ecto/changeset/embedded_test.exs:473: warning: variable old_changeset is unused | |
| test/ecto/changeset/embedded_test.exs:480: warning: variable changeset is unused | |
| test/ecto/changeset/embedded_test.exs:487: warning: variable changeset is unused | |
| test/ecto/changeset/embedded_test.exs:492: warning: variable changeset is unused |
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
| var webpack = require("webpack"); | |
| var ExtractTextPlugin = require("extract-text-webpack-plugin") | |
| module.exports = { | |
| entry: "./web/static/app/app.js", | |
| output: { | |
| path: "./priv/static/js", | |
| filename: "app.js" | |
| }, |
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
| # WKHTMLTOPDF ################################################################# | |
| RUN apt-get update \ | |
| && apt-get -y install build-essential xorg libssl-dev libxrender-dev \ | |
| && mkdir -p /usr/src/wkhtmltopdf \ | |
| && curl -fSL -o wkhtmltopdf.tar.bz2 "http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2" \ | |
| && tar -xzjf wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2 -C /usr/src/wkhtmltopdf \ | |
| && rm wkhtmltopdf.tar.bz2 | |
| && cd /usr/src/wkhtmltopdf \ |
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
| require 'bundler' | |
| Bundler.setup | |
| require 'json' | |
| require 'benchmark/ips' | |
| require 'redis' | |
| require 'securerandom' | |
| REDIS = Redis.new(url: 'redis://localhost:6379/11') |
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
| namespace :puma do | |
| desc 'Start puma' | |
| task :start do | |
| on roles(:app) do | |
| execute 'sudo start puma' | |
| end | |
| end | |
| desc 'Stop puma' | |
| task :stop do |
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
| require 'benchmark' | |
| N = 10_000 | |
| C = %w[a b c] * 100 | |
| Benchmark.bmbm do |x| | |
| x.report "||=" do | |
| N.times do | |
| C.each_with_object({}) do |val, memo| | |
| memo[val] ||= [] |
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
| #!/usr/bin/env puma | |
| require 'dotenv' | |
| threads 16, 16 | |
| quiet | |
| # Clustering ################################################################## |
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 PrimeSieve do | |
| @moduledoc """ | |
| 1. Create a list l of consecutive integers {2,3,…,N}. | |
| 2. Select p as the first prime number in the list, p=2. | |
| 3. Remove all multiples of p from the l. | |
| 4. Set p equal to the next integer in l which has not been removed. | |
| 5. Repeat steps 3 and 4 until p^2 > N, all the remaining numbers in the list are primes | |
| """ | |
| def primes(n) do | |
| numbers = 2..(n - 1) |
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 CustomTest.Case do | |
| use ExUnit.CaseTemplate | |
| alias Ecto.Adapters.SQL | |
| setup_all do | |
| SQL.begin_test_transaction(Repo) | |
| on_exit fn -> | |
| SQL.rollback_test_transaction(Repo) |
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
| defimpl Poison.Encoder, for: App do | |
| def encode(app, options) do | |
| Poison.Encoder.Map.encode(%{id: app.id, name: app.name}, options) | |
| end | |
| end |