View data.ex
deals = [
%{id: 1, amount: 1000, closed_at: ~N[2016-11-01 08:10:00]},
%{id: 2, amount: 1000, closed_at: ~N[2016-11-01 12:20:00]},
%{id: 3, amount: 1000, closed_at: ~N[2016-11-01 23:30:00]},
%{id: 4, amount: 1000, closed_at: ~N[2016-11-02 04:40:00]},
%{id: 5, amount: 1000, closed_at: ~N[2016-11-03 15:50:00]},
%{id: 6, amount: 1000, closed_at: ~N[2016-11-04 18:51:00]},
%{id: 7, amount: 1000, closed_at: ~N[2016-11-04 10:02:00]},
%{id: 8, amount: 1000, closed_at: ~N[2016-11-05 11:14:00]},
%{id: 9, amount: 1000, closed_at: ~N[2016-11-06 01:43:00]},
View compile
info "Building Phoenix static assets"
npm run build
mix phoenix.digest
View index.html
<!doctype html>
<script>
function $(selector) {
return document.querySelectorAll(selector)
}
function onClick(selector, callback) {
$("html")[0].addEventListener("click", function(event) {
View gulpfile.js
var gulp = require('gulp'),
watch = require('gulp-watch'),
// This will keeps pipes working after error event
plumber = require('gulp-plumber'),
// linting
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
View gulpfile.js
var gulp = require('gulp');
var es = require('event-stream');
var coffee = require('gulp-coffee');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var paths = {
coffeeSrc: 'assets/coffee/**/*.coffee',
coffeeDest: 'assets/js',
View puma_rails_heroku.rb
# Gemfile
gem "puma"
# Procfile
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb
# add to config block config/environments/production.rb
config.threadsafe!
# get rid of NewRelic after_fork code, if you were doing this:
View pinterestify.rb
# Takes some markup (html or markdown) and wraps img elements into
# a div with a pinterest share link before image
# Params:
# markup - html or markdown that contains the images
# url - url for the shared item on pinterest
# desc - description for shared item on pinterest
# markdown - (optional) true if markup needs to be parsed as markdown (default), otherwise false
# wrap_class - (optional) css class for the img wrapper (default: pin-wrapper)
# pin_text - (optional) text for the pinterest link (default: Pin to Pinterest)
def pinterestify(markup, url, desc, options = {})
View nginx.conf
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;