Skip to content

Instantly share code, notes, and snippets.

View Keshava11's full-sized avatar
🎯
Focusing

Bruce Keshava11

🎯
Focusing
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@alexchung
alexchung / Blockout.py
Created February 9, 2014 23:11
Blockout encryption/decryption methods ported to Python
# -*- coding: utf-8 -*-
import sys
import os
import base64
import bcrypt
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
class Blockout:
@alex-shpak
alex-shpak / Interceptor.java
Last active June 14, 2024 02:40
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@macloo
macloo / dict_example.py
Created April 9, 2017 14:34
How Flask session variables work
# python 3
# a review of Python’s dictionary format
# create a new dict - named session - with three key:value pairs:
session = { 'logged_in': True, 'user': 'Harry Potter', 'password': 'parseltongue' }
# create a new dict - named session2 - with three key:value pairs
# another way to create a dict)
session2 = {}
session2['logged_in'] = False
@demixdn
demixdn / EditTextDebounce.java
Created April 24, 2017 09:58
Get text from EditText with debounce without RxJava
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import java.lang.ref.WeakReference;
@abstractart
abstractart / books.md
Last active February 28, 2025 11:33
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ
@florina-muntenescu
florina-muntenescu / BaseDao.kt
Last active January 1, 2025 06:52
Use Dao inheritance to reduce the amount of boilerplate code - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@sienatime
sienatime / AppDatabase.java
Last active September 25, 2020 12:31
Code snippets for adding FTS support to Room (Android architecture components)
@Database(entities = {
Entry.class, Sense.class, CrossReference.class, EntryFts.class
}, version = 4, exportSchema = false) public abstract class AppDatabase extends RoomDatabase
@codeSTACKr
codeSTACKr / mongodb_cheat_sheet_2022.md
Created January 10, 2022 22:54
MongoDB Cheat Sheet 2022