Skip to content

Instantly share code, notes, and snippets.

twonjosh / Create iOS Icons.jsx
Last active Jun 17, 2021 — forked from ma11hew28/Create Icons.jsx
Photoshop Script to Create iOS Icons from a source image
View Create iOS Icons.jsx
// Photoshop Script to Create iPhone Icons from iTunesArtwork
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones
emil2k /
Last active Jan 24, 2022
Android utility class for checking device's network connectivity and speed.
* Copyright (c) 2017 Emil Davtyan
* 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:
mathewbyrne / CsvResponse.php
Created Mar 21, 2013
A small Symfony 2 class for returning a response as a CSV file. Based on the Symfony JsonResponse class.
View CsvResponse.php
namespace Jb\AdminBundle\Http;
use Symfony\Component\HttpFoundation\Response;
class CsvResponse extends Response
protected $data;
artschwagerb /
Created Nov 14, 2013
Django Database Routers Master-Slave
import random
class MasterSlaveRouter(object):
def db_for_read(self, model, **hints):
Reads go to a randomly-chosen slave.
return random.choice(['master','slave1', 'slave2'])
def db_for_write(self, model, **hints):
gabrielemariotti /
Last active Jan 23, 2022
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (

This is a porting of the class SimpleSectionedListAdapter provided by Google



isaac-jordan /
Last active Feb 2, 2019
An updated version of django-premailer that works with Django 1.9 and Python 3.
# Put in 'templatetags' folder in your Django app.
from __future__ import absolute_import
from django import template
from django.utils.encoding import smart_text
from django.contrib.staticfiles import finders
from import staticfiles_storage
from django.conf import settings
from premailer import Premailer
aschmu /
Last active Dec 9, 2021
Setting up a PyPi mirror

I) Introduction

Taken from: [!topic/devpi-dev/S-3ioWILTiY]).

We wanted to do some python developpement but we had a problem : our working network is completely isolated from any internet access, only having servers providing services like distribution packages repository mirror and web servers. The question then was how to make a full pypi mirror for usig pip install and pip search.

This is possible to be done using devpi, a web server, bandersnatch and an external hard drive. The idea is to dump all pypi packages with bandersnatch, transfer them to the server with the hard drive,

chibatching / FlowThrottleDebounce.kt
Last active Dec 5, 2021
Throttle and Debounce on Flow Kotlin Coroutines
View FlowThrottleDebounce.kt
fun <T> Flow<T>.throttle(waitMillis: Int) = flow {
coroutineScope {
val context = coroutineContext
var nextMillis = 0L
var delayPost: Deferred<Unit>? = null
collect {
val current = SystemClock.uptimeMillis()
if (nextMillis < current) {
nextMillis = current + waitMillis
jamiesanson / ViewLifecycleBinding.kt
Last active Jan 2, 2022
Kotlin Property Delegate for Fragment view lifecycle binding
View ViewLifecycleBinding.kt
fun <T> Fragment.viewLifecycle(bindUntilEvent: Lifecycle.Event = Lifecycle.Event.ON_DESTROY): ReadWriteProperty<Fragment, T> =
object: ReadWriteProperty<Fragment, T>, LifecycleObserver {
// A backing property to hold our value
private var binding: T? = null
private var viewLifecycleOwner: LifecycleOwner? = null
init {
// Observe the View Lifecycle of the Fragment