Skip to content

Instantly share code, notes, and snippets.

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

Douglas Zaltron douglaszaltron

👨‍💻
Focusing
View GitHub Profile
@baali
baali / dlAttachments.py
Created May 8, 2012 08:32
Python script to download all gmail attachments.
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'
@digitaljhelms
digitaljhelms / gist:4287848
Last active July 25, 2024 08:06
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@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
@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.
#
@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);
})
@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
*/
(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) {
@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
const data = [
{
name: "Alexandre",
city: "MG",
age: "45"
},
{
name: "Ricardo",
city: "MG",
age: "32"
@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'
})