See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
# http://adventofcode.com/2017/day/1 | |
defmodule Day1 do | |
def sum1(digits), do: | |
digits | |
|> Stream.concat(Enum.take(digits, 1)) | |
|> Stream.chunk_every(2, 1, :discard) | |
|> Stream.filter(&match?([el, el], &1)) | |
|> Stream.map(&hd(&1)) | |
|> Enum.sum() |
In this tutorial we are going to show how easy it is to build a notification feed using GetStream.io. First of all, let's quickly introduce you to our fictional example app. It's called bug-your-friends.com and allows you interact with your friends, ping them, follow them or poke them. Here's a quick list of example interactions:
Whenever a user is part of one of these interactions, we want to update his notification feed, update the number of unseen and unread
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionDebugger
#!/usr/bin/env ruby | |
# gem install sinatra --no-document | |
# gem install github-markdown --no-document | |
require 'sinatra' | |
require 'github/markdown' | |
set :port, 3000 | |
get '/' do | |
<<-EOT | |
<!DOCTYPE html> |
#!/usr/bin/env ruby | |
# generate a single sentence from a canonical form | |
# canonical sentence is a multi sentences combined in one | |
# form, generator will generate a sentence from it randomly | |
# based on the form, for example: | |
# "Hello [Emad|Elsaid]" , may generate "Hello Emad" or | |
# "Hello Elsaid" the result is random. | |
# also you could nest [] inside each other to gain a multi level | |
# canonical sentence example: | |
# "[[Hi|Hello] [Emad|elsaid] | good [morning|night] sir]" |
#!/usr/bin/env ruby | |
# Credits to : | |
# http://stackoverflow.com/questions/16365553/creating-gist-from-a-ruby-script | |
# i modified the script alittle bit to read files from params | |
require 'net/http' | |
require 'json' | |
uri = URI("https://api.github.com/gists") |
# this monit config goes in /etc/monit/conf.d | |
check process puma_master | |
with pidfile /data/myapp/current/tmp/puma.pid | |
start program = "/etc/monit/scripts/puma start" | |
stop program = "/etc/monit/scripts/puma stop" | |
group myapp | |
check process puma_worker_0 | |
with pidfile /data/myapp/current/tmp/puma_worker_0.pid |
Having a buckload of code to authorize users on your application is something you may like or not.
Speaking for myself I hate it. But I still love rails_admin
, here's how you install it without devise. Thanks to phoet for providing the hints in the gist I have forked from.
do NOT add devise
gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"