Skip to content

Instantly share code, notes, and snippets.

View ankopainting's full-sized avatar

Anko ankopainting

  • Brisbane, Australia
View GitHub Profile
@bsedat
bsedat / Dockerfile
Last active August 8, 2023 05:56
Elixir Phoenix Umbrella App + Distillery Multistage Docker Build
FROM elixir:1.4.5 as asset-builder-mix-getter
ENV HOME=/opt/app
RUN mix do local.hex --force, local.rebar --force
# Cache elixir deps
COPY config/ $HOME/config/
COPY mix.exs mix.lock $HOME/
COPY apps/myproject_web/mix.exs $HOME/apps/myproject_web/
COPY apps/myproject_web/config/ $HOME/apps/myproject_web/config/
@equivalent
equivalent / activerecord_mapping_edge_ngram.rb
Last active August 9, 2022 17:39
ActiveRecord Elasticsearch edge ngram example for Elasticsearch gem Rails
require 'ansi'
require 'sqlite3'
require 'active_record'
require 'elasticsearch/model'
ActiveRecord::Base.logger = ActiveSupport::Logger.new(STDOUT)
ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ":memory:" )
ActiveRecord::Schema.define(version: 1) do
create_table :articles do |t|
@boxnos
boxnos / time_ago_in_words.js
Last active November 14, 2019 06:21
time_ago_in_words in JavaScript
var time_ago_in_words = function(from, to) {
to = to ? to : Date.now();
var minutes = (to - from) / 60000;
var data = [
[0 , 'less than a minute ago'],
[1 , 'a minute ago'],
[2 , function(m) {return m.toFixed() + ' minutes ago';}],
[45 , 'about 1 hour ago'],
@hfwang
hfwang / create_models_migration.rb
Created April 10, 2012 18:01
Use Ruby's marshal facilities in ActiveRecord to serialize some attributes for schema-less awesome.
class CreateModels < ActiveRecord::Migration
def change
create_table :models do |t|
t.binary :extras
t.timestamps
end
end
end
@zellyn
zellyn / vagrant.org
Created April 3, 2010 18:25
Setting up a CentOS 5.4 base box for Vagrant