Skip to content

Instantly share code, notes, and snippets.

View douglaszaltron's full-sized avatar
👨‍💻
Focusing

Douglas Zaltron douglaszaltron

👨‍💻
Focusing
View GitHub Profile
@jarussi
jarussi / oficina.md
Last active August 10, 2022 22:14
Oficina CS-GO

Configurando server de Counter Strike Global Ofensive no Ubuntu Server

Gerando uma chave ssh

Vai ser necessário gerar uma chave ssh para se conectar na instância criada, para gerar a chave é só seguir esse tutorial do google

Conectar na máquina

ssh ubuntu@{{ ip da maquina }}
@olafwrieden
olafwrieden / Landing.js
Last active October 19, 2023 02:17
React Hooks + Azure App Configuration Feature Flags
const Landing = () => {
const { config: alertMessage } = useConfiguration('Landing:Alert'); // The config key from App Config
const { enabled: showLandingAlert } = useFeatureFlag('ShowLandingAlert'); // The feature flag key from App Config
const showAlert = showLandingAlert && alertMessage.toString().trim().length;
return (
<>
{showAlert && <TopAlert color="success">{alertMessage}</TopAlert>}
@robertluiz
robertluiz / sequelize-migration-generator.js
Last active May 15, 2019 18:31
sequelize auto migration generator
const models = require('../app/models')
const Sequelize = require('sequelize')
const fs = require('fs')
const path = require('path')
const sequelize = new Sequelize('', '', '', {
host: '',
dialect: 'postgres'
})
const data = [
{
name: "Alexandre",
city: "MG",
age: "45"
},
{
name: "Ricardo",
city: "MG",
age: "32"
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active May 10, 2024 09:22
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
(function () {
'use strict'
const QUOTES = ['', "'", '"']
// const THRESHOLD = 0.95
// function levenstein(a, b) {
// const d = (i, j) => 0 === Math.min(i, j) ? Math.max(i, j) : Math.min(d(i - 1, j) + 1, d(i, j - 1) + 1, d(i - 1, j - 1) + (a[i - 1] === b[j - 1] ? 0 : 1))
// return d(a.length, b.length)
// }
// levenstein('kitten', 'sitting')
// function ratio(a, b) {
@sloanwolf
sloanwolf / ReactNativeChatScreenExample.js
Last active April 3, 2023 04:27
React-Native Chat screen with bottom TextInput
/*
* Below is a bare functioning example of how I made a React-Native Chat messaging component that shifts the input up when
* the keyboard is active, and scrolls back down when the keyboard is inactive from a TextInput blur.
*
* The only thing I haven't been able to figure out yet is getting the ListView to render from the bottom, not sure if it's
* possible yet via styles.
*
* NOTE: This uses from iOS-only properties
*/
@varmais
varmais / thinced.js
Created October 1, 2015 19:43
Geolocation to Promise wrap example
var getPosition = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
getPosition()
.then((position) => {
console.log(position);
})
@styrmis
styrmis / download_attachments_from_sender_gmail.py
Created March 19, 2014 08:55
Download all attachments from Gmail from a specific sender
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
@katowulf
katowulf / 1_using_queries.js
Last active April 24, 2023 07:14
Methods to search for user accounts by email address in Firebase
/***************************************************
* Simple and elegant, no code complexity
* Disadvantages: Requires warming all data into server memory (could take a long time for MBs of data or millions of records)
* (This disadvantage should go away as we add optimizations to the core product)
***************************************************/
var fb = firebase.database.ref();
/**
* @param {string} emailAddress