Skip to content

Instantly share code, notes, and snippets.

View nikialeksey's full-sized avatar
🏠
Working from home

Alexey Nikitin nikialeksey

🏠
Working from home
View GitHub Profile
@MisterRager
MisterRager / Rx2ServiceBindingFactory.java
Last active July 17, 2019 18:46
Bind to an Android service using RxJava!
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import io.reactivex.Observable;
@tpb1908
tpb1908 / BarSpan.java
Created March 2, 2017 20:28
Android bar span to draw a line through the full width of a TextView
package com.yourpackage.package
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.text.style.ReplacementSpan;
/**
* Created by theo on 02/03/17.
@odyniec
odyniec / test_temp_directory.py
Last active August 29, 2024 17:19
An example Python unittest test case that creates a temporary directory before a test is run and removes it when it's done.
import shutil, tempfile
from os import path
import unittest
class TestExample(unittest.TestCase):
def setUp(self):
# Create a temporary directory
self.test_dir = tempfile.mkdtemp()
def tearDown(self):
@quchie
quchie / Send Email.groovy
Last active November 27, 2022 23:19
Send email using groovy script
import javax.mail.*
import javax.mail.internet.*
/*
Get Any JAVAMAIL Dependency
===============================
Download JAVAMAIL dependency that you need.
download JAVAMAIL at : https://maven.java.net/content/repositories/releases/com/sun/mail/javax.mail/1.5.2/javax.mail-1.5.2.jar
To install, copy & paste the *.jar to installed Groovy lib directory:
eg: C:\Program Files (x86)\Groovy\Groovy-2.1.1\lib
@e000
e000 / donotuse.py
Created June 13, 2011 23:30
How to NEVER use lambdas.
##########################################################
# How to NEVER use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda constru-#
# ct in Python 2.x. [DO NOT USE ANY OF THIS EVER] #
# by: e000 (13/6/11) #
##########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much anonymous "one line" functions
@ssokolow
ssokolow / pagination_example.sql
Created December 23, 2009 13:02
Reasonably efficient pagination without OFFSET (SQLite version)
-- Reasonably efficient pagination without OFFSET
-- SQLite version (Adapted from MS SQL syntax)
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6
SELECT foo, bar, baz, quux FROM table
WHERE oid NOT IN ( SELECT oid FROM table
ORDER BY title ASC LIMIT 50 )
ORDER BY title ASC LIMIT 10