This file contains 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
# Basic key operators to query the JSON objects : | |
# #> : Get the JSON object at that path (if you need to do something fancy) | |
# -> : Get the JSON object at that path (if you don't) | |
# ->> : Get the JSON object at that path as text | |
# {obj, n} : Get the nth item in that object | |
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE | |
# Date | |
# date before today |
This file contains 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
[Unit] | |
Description=Sidekiq workers | |
# start as many workers as you want here | |
[email protected] | |
[email protected] | |
# ... | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/true |
This file contains 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
slugs = %w[ a-g-c-da-costa-agape-assessoria-e-consultoria-educacional a-hora-do-saber aeoa-associacao-centro-educacional-olivia-araujo aldeiamirim-br alicerce-empreendimentos-educacionais-ltda anglo-21-anglo-chacara aldeiadaserra-br angloalphaville-br bauru-br dedracena-br anglogranjaviana-br anglo-itapema itapetininga-br itu-br jales-br lorena-br matao-br morumbi-br osasco-br paulinia1-br penapolis-br renovacaoindaiatuba-br renovacaosp-br salto-br sorocabaef1-br tatui-br treslagoas-br vargemgrande-br vargemgrande-br antares-unidade-6-ws apm-da-eefmt-prof-dagmar-ribas-trintade apm-da-eemft-m-theodora-pedreira-de-freitas arca-comunidade-educacional-i arquimedes-porto-ferreira arquimedes-santos-dumont arteceb aslan-br aslan-br aslans-course-ananindeua aslans-course-belem assoc-de-prot-e-assist-a-maternidade-e-a-infancia colegiojesusadolescente-br prudentina-br associacao-de-pais-e-professores-do-colegio-shalom-appcs ativa-idade basilio-s-colegio-curso basilio-scol-curso bom-comeco c-e-i-c-centro-de-estudos-inte |
This file contains 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 'omniauth' | |
require 'omniauth-saml' | |
class MultiProviderSamlHandler | |
UUID_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ | |
attr_reader :path_prefix, :provider_name | |
def initialize(path_prefix: OmniAuth.config.path_prefix, provider_name: 'saml') | |
@path_prefix = path_prefix |
This file contains 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
stat -c "%a %n" * |
This file contains 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
# Better each() for use with coffeescript | |
# 1. Wraps child in jquery object | |
# 2. Sets child first argument, so that fat-binding can be used. | |
# 3. Sets @ as well, for normal binds | |
jQuery.fn.loop = (block) -> | |
for i in @ | |
element = jQuery(i) | |
res = block.call element, element | |
break if res == false |
This file contains 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
# admin/seo/_seo_form.html.erb | |
<div class='full-inputs'> | |
<%= simple_form_for seo, remote: true, url: admin_update_seo_path(seo) do |f| %> | |
<%= f.input :content, required: true, as: :text, input_html: {rows: 2, maxlength: "#{ seo.name == 'title' ? '70' : '155' }"}, label: seo.name.try(:humanize), hint: "<span class='character-count green'> </span> #{seo.name.try(:humanize)} should be no longer than #{ seo.name == 'title' ? '70' : '155' } characters" %> | |
<div class='text-center'> | |
<button class='btn btn-primary'>Update</button> | |
<a href="#<%= page %>" class='cancel-seo btn btn-warning' data-attribute="<%=f.object.id %>"> Cancel</a> | |
<% end %> |
This file contains 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
# Create a private key | |
openssl genrsa -des3 -out server.pass.key 2048 | |
# Strip password from private key | |
openssl rsa -in server.pass.key -out server.key | |
# Generate a CSR | |
openssl req -nodes -new -key server.key -out server.csr | |
# For NGINX, request a single PEM certificate, otherwise you'll get a SSL authority cert & site cert. |
This file contains 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
class DbSetup < ActiveRecord::Migration | |
def up | |
create_schema :oauth | |
create_table "oauth.oauth_applications" do |t| | |
t.string :name, null: false | |
t.string :uid, null: false | |
t.string :secret, null: false | |
t.text :redirect_uri, null: false | |
t.integer :owner_id, null: false |
This file contains 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 bash | |
# Usage: pair [<github-user>] [-t <tmux-session>] | |
# | |
# Copy the command to clipboard which grants another person access to the tmux | |
# session on your machine. The resulting command is in format: | |
# | |
# ssh -t <USER>@<HOST> 'tmux attach -t <SESSION>' | |
# | |
# When given a GitHub username, it will adopt SSH keys from their GitHub | |
# account and add them to your `~/.ssh/authorized_keys`. |
NewerOlder