Skip to content

Instantly share code, notes, and snippets.

View jdanielnd's full-sized avatar

João Duarte jdanielnd

View GitHub Profile
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: backstage
description: An example of a Backstage application.
annotations:
backstage.io/techdocs-ref: dir:./
# Example for optional annotations
# annotations:
# github.com/project-slug: backstage/backstage

Manipulando objetos no JavaScript

O que é um objeto no JavaScript?

Um objeto no JavaScript é uma coleção de chaves e valores. Ou seja, são pares de informações onde a chave cumpre um papel de identificador, que armazena um determinado valor. Cada par de informação é chamado de propriedade.

Por exemplo, se temos um objeto Usuário, que possui as propriedades nome e idade, ele é representado da seguinte forma:

require 'active_support/configurable'
module Statistics
include ActiveSupport::Configurable
config_accessor :end_point
self.config.server ||= "https://statistics.appprova.com.br"
require 'devise/strategies/authenticatable'
module Devise
module Strategies
class MixedAuthenticatable < Authenticatable
def authenticate!
authenticator.authenticate!
end
private
@jdanielnd
jdanielnd / ldap_authenticable.rb
Created September 2, 2014 16:00
Devise LDAP Authenticable
require 'net/ldap'
require 'devise/strategies/authenticatable'
module Devise
module Strategies
class LdapAuthenticatable < Authenticatable
def authenticate!
if params[:user]
ldap = Net::LDAP.new
domain = "ou=users,dc=test,dc=com"
@jdanielnd
jdanielnd / xvfb
Created May 22, 2013 14:31
xvfb init.d script
XVFB=/usr/bin/Xvfb
XVFBARGS=":99 -ac -screen 0 1024x768x24"
PIDFILE=/var/run/xvfb/xvfb.pid
DISPLAY=:0.0
export DISPLAY
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."