Skip to content

Instantly share code, notes, and snippets.

@icek
icek / $.3.js
Last active January 21, 2016 20:47 — forked from ofca/$.3.js
// original ofca/$.3.js
// based on https://gist.github.com/Potfur/5576225 & https://github.com/james2doyle/saltjs
// more info: https://plus.google.com/109231487156400680487/posts/63eZzzrBSb6
// 2 bytes less than original ;)
// V1 - 160b
window.$ = function(s,c) {
c = {
'#': 'ById',
#!/bin/bash
#
# Bash script to clean up stray branches that have no "upstream" branch
#
# USE AT OWN RISK
#
# gitclean [--no-interactive]
#
# - no-interactive: Automatically deletes the branch, without showing the diff
# and asking for confirmation
@daviddao
daviddao / spatial_transformer.py
Last active June 28, 2017 05:04
Tensorflow Spatial Transformer
import tensorflow as tf
def transformer(U, theta, downsample_factor=1, name='SpatialTransformer', **kwargs):
"""Spatial Transformer Layer
Implements a spatial transformer layer as described in [1]_.
Based on [2]_ and edited by David Dao for Tensorflow.
Parameters
----------
@tokestermw
tokestermw / tf_ed_vi_tutorial.py
Last active July 19, 2019 01:18
Variational inference and Bayesian deep learning tutorial (w/ uncertainty intervals) using TensorFlow and Edward.
""" Some description.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import json
import tqdm
@swankjesse
swankjesse / RetrofitCachingExample.java
Created June 29, 2013 03:03
Demonstrate HTTP caching with OkHttp and Retrofit.
/*
* Copyright (C) 2013 Square, Inc.
*
* 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
@gabrielemariotti
gabrielemariotti / MainActivity.java
Last active February 15, 2021 17:32
How to obtain a CardView (support library) with a Image and rounded corners for API<21
ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
//Default
imageView.setBackgroundResource(R.drawable.rose);
} else {
//RoundCorners
RoundCornersDrawable round = new RoundCornersDrawable(mBitmap,
getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius
@kukuruza
kukuruza / gist_cifar10_train.py
Last active March 4, 2021 01:58
Tensorflow: visualize convolutional filters (conv1) in Cifar10 model
from math import sqrt
def put_kernels_on_grid (kernel, pad = 1):
'''Visualize conv. filters as an image (mostly for the 1st layer).
Arranges filters into a grid, with some paddings between adjacent filters.
Args:
kernel: tensor of shape [Y, X, NumChannels, NumKernels]
pad: number of black pixels around each filter (between them)
@jimgoo
jimgoo / readme.md
Last active October 11, 2022 08:58
CaffeNet fine-tuned on the Oxford 102 category flower dataset
@gabrielemariotti
gabrielemariotti / README.md
Last active March 9, 2023 06:02
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

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

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* 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