Skip to content

Instantly share code, notes, and snippets.

View danielvlopes's full-sized avatar

Daniel Lopes danielvlopes

View GitHub Profile
def feature_enabled?(feature)
FeatureFlag.enabled?(feature, current_organization)
end
$font-family-sans-serif:
// Cross-platform generic font family (default user interface font)
system-ui,
// Safari for macOS and iOS (San Francisco)
-apple-system,
// Windows
"Segoe UI",
// Android
Roboto,
// Basic web fallback
// COPIED FROM HERE: https://www.jorgemanrubia.com/2019/02/16/form-validations-with-html5-and-modern-rails/
import { Controller } from 'stimulus'
export default class extends Controller {
connect () {
this.element.setAttribute('novalidate', true)
this.element.addEventListener('blur', this.onBlur, true)
this.element.addEventListener('submit', this.onSubmit)
this.element.addEventListener('ajax:beforeSend', this.onSubmit)
@danielvlopes
danielvlopes / intercom.js
Created January 14, 2021 03:35
Adding support for Turbo to Intercom
!(function (e) {
var t = {};
function n(o) {
if (t[o]) return t[o].exports;
var r = (t[o] = { i: o, l: !1, exports: {} });
return e[o].call(r.exports, r, r.exports, n), (r.l = !0), r.exports;
}
(n.m = e),
(n.c = t),
(n.d = function (e, t, o) {
@danielvlopes
danielvlopes / watercooler_discourse_badges.scss
Last active April 17, 2020 18:33
Custom CSS Badges design for our community feature in knowyourteam.com
$badge-gold-background: #FFE629;
$badge-gold-content: #E2A53C;
$badge-silver-background: #B0DBEC;
$badge-silver-content: #275665;
$badge-bronze-background: #FF6136;
$badge-bronze-content: #A52A07;
.badge-groups {

Opensource Bug Bounty platform

@danielvlopes
danielvlopes / pt
Last active October 30, 2018 20:42
This is Comperj.
The biggest petrochemical complex in Brazil.
It’s located in Itaboraí, a small city in the state of Rio de Janeiro.
The multibillion dollar project launched in 2008 and the plan was to open in 2011.
Thousands of Brazilians moved there to work.
But it’s 2018, and Comperj never opened.
Construction of the complex stopped in 2015, after it became a symbol of the largest corruption
scandal in Brazil’s history -- Operation Car Wash.
Hundreds of prominent Brazilians including CEOs, members of Congress and even a former
President have been implicated.
def flatten(s):
if s == []:
return s
if isinstance(s[0], list):
return flatten(s[0]) + flatten(s[1:])
return s[:1] + flatten(s[1:])
l1 = [[1,2],[3,4],[[5,6],[7,8],[[[1,3]]]]]
print flatten(l1)
@danielvlopes
danielvlopes / wysiwyg.css
Created February 21, 2018 06:33 — forked from goncalvesjoao/wysiwyg.css
[VanillaJs] Trix v0.11.1 Toolbar attachment file button
.trix-button--icon-attach-files::before {
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA%2FPjxzdmcgaGVpZ2h0PSIxNnB4IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAyNCAxNiIgd2lkdGg9IjI0cHgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c2tldGNoPSJodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2gvbnMiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48dGl0bGUvPjxkZXNjLz48ZGVmcy8%2BPGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSI%2BPGcgZmlsbD0iIzAwMDAwMCIgaWQ9IkNvcmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMjYuMDAwMDAwLCAtNDYuMDAwMDAwKSI%2BPGcgaWQ9ImJhY2t1cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTI2LjAwMDAwMCwgNDYuMDAwMDAwKSI%2BPHBhdGggZD0iTTE5LjQsNiBDMTguNywyLjYgMTUuNywwIDEyLDAgQzkuMSwwIDYuNiwxLjYgNS40LDQgQzIuMyw0LjQgMCw2LjkgMCwxMCBDMCwxMy4zIDIuNywxNiA2LDE2IEwxOSwxNiBDMjEuOCwxNiAyNCwxMy44IDI0LDExIEMyNCw4LjQgMjEuOSw2LjIgMTkuNCw2IEwxOS40LDYgWiBNMTQsOSBMMTQsMTMgTDEwLDEzIEwxMCw5IEw3LDkgTDEyLDQgTDE3LDkgTDE0LDkgTDE0LDkgWiIgaWQ9IlNoYXBlIi8%2B
>>> answer = "yes"
>>> num_answers = 0
>>> if answer:
... num_answers = num_answers + 1
...
>>> answer = ""
>>>
>>> print num_answers
1
>>> print answer