Skip to content

Instantly share code, notes, and snippets.

View phsacramento's full-sized avatar

Paulo Henrique Sacramento phsacramento

View GitHub Profile
import Config
defmodule Environment do
@moduledoc """
This modules provides various helpers to handle environment metadata
"""
def get(key), do: System.get_env(key)
def get_boolean(key) do
def handle_invalid_entries(reasons, uid, pid)
if reasons.include?(:person_not_registered)
@logger.info("[Toggl::TimeEntryImporter] Person not registered: #{uid}")
end
if reasons.include?(:without_description)
@logger.info("[Toggl::TimeEntryImporter] Time entry without description from user #{uid}")
end
if reasons.include?(:without_project)
var formatForm = function(){
var that = this;
this.$form = $('form');
this.startup = function(){
if(!this.$form[0]){ return false; }
this.$form.find('input.tel').mask("(99) 9?9999-9999");
this.$form.find('input.cep').mask("99999-999");
this.$form.find('input.cpf').mask("999.999.999-99");
@phsacramento
phsacramento / gem_install.sh
Created June 13, 2017 20:29
Error installing EventMachine gem on OSX
gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include
# encoding: UTF-8
module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
settings index_configuration do
mapping do
@phsacramento
phsacramento / searcheble.rb
Created January 21, 2017 01:00
work in progress!
# encoding: UTF-8
module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
settings index_configuration do
@phsacramento
phsacramento / firebase-example.js
Last active December 12, 2016 10:41
Firebase counter increment
var vm = this;
var databaseColumn = firebase.database().ref('database');
vm.count = 0;
databaseColumn.on('value', function(snapshot) {
snapshot.forEach(function() {
$scope.count++;
});
});
(function() {
'use strict';
angular
.module('app.restaurants')
.controller('RestaurantsController', RestaurantsController);
RestaurantsController.$inject = ['RestaurantsService', 'LocationStateService', '$scope', '$location', '$ionicPopup', '$ionicScrollDelegate', 'FilterService', '$timeout'];
function RestaurantsController(RestaurantsService, LocationStateService, $scope, $location, $ionicPopup, $ionicScrollDelegate, FilterService, $timeout) {
@phsacramento
phsacramento / edit_current_store.md
Created June 29, 2016 19:38
Edit Current store spree
store = Spree::Store.current
```
require 'rails_helper'
RSpec.describe Admin::CoursesController, type: :controller do
let(:valid_attributes) {
attributes_for(:course)
}
let(:invalid_attributes) {