Skip to content

Instantly share code, notes, and snippets.

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

Aye Aye Mon noblesilence

🏠
Working from home
View GitHub Profile
@jirivrany
jirivrany / PhotoAdapter.java
Created January 10, 2016 20:22
Example of undo action for Android RecyclerView onSwipe.
public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.PhotoViewHolder> implements View.OnClickListener {
private ArrayList<Photo> photos;
public ArrayList<Photo> photosToRemove;
private OnItemClickListener onItemClickListener;
private Context context;
public PhotoAdapter(Context context, ArrayList<Photo> photos, Map<Integer, String> authors, int colHeigth) {
@atelic
atelic / gulpfile.js
Created May 24, 2015 04:00
Basic gulpfile for minify and concat css and javascript
/*
Before using make sure you have:
npm install --save-dev gulp gulp-minify-css gulp-concat gulp-uglify gulp-autoprefixer gulp-sass
Make sure to change the directory names in the default watch function to the CSS/SCSS/SASS directories you are using so it reloads
*/
var gulp = require('gulp'),
minifyCSS = require('gulp-minify-css'),
concat = require('gulp-concat')
@dylanvalade
dylanvalade / jquery-center-vertical.js
Last active September 20, 2016 14:07
Center child element vertically within parent with jQuery
// child: jquery object e.g $(".active .slide-caption")
// parent: jquery object e.g $(".active.slide")
// property (string): CSS property to change depending on your CSS positioning e.g. "top", "margin-top" or "bottom"
function centerVertical(child, parent, property) {
var parentHeight = parent.height(),
childHeight = child.height();
// Handle edge cases with padding or margins affecting child.height() calculation
if (child.find("h1").length) {
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>