Skip to content

Instantly share code, notes, and snippets.

@torchhound
torchhound / README.md
Last active April 26, 2017 05:09
A click / long press listener for RecyclerViews. Questions? https://twitter.com/lnikkila
@torchhound
torchhound / 500px Blur View
Last active March 8, 2017 05:41
500px Blur View Library Implementation
<com.fivehundredpx.android.blur.BlurringView
android:id="@+id/blurring_view"
android:layout_width="match_parent"
android:layout_height="56dp"
app:blurRadius="2"
app:downsampleFactor="6"
app:overlayColor="@color/player_bottom"/>
app build.gradle
@torchhound
torchhound / Purescript Pux Codedeploy Config
Last active November 2, 2017 21:49
purescript-pux-codedeploy
Config files
@torchhound
torchhound / riot_lambdaconf_setup.md
Last active May 17, 2018 05:58
Lambdaconf Riot Attendee Setup

Install Riot

Download and install Riot for the platform of your choice. Supported platforms include Android(Play and F-Droid), iOS, OSX, Windows, Linux, and browser.

Download

Create an Account

You should see a screen similar to the below image. Enter your information and make sure that you use the default matrix.org server unless you know what you are doing. If you do not enter an email or phone number you will have to authenticate through the browser.

@torchhound
torchhound / index.js
Created November 1, 2018 01:08
mongo-crud index.js
const express = require('express')
const bodyParser = require('body-parser')
const MongoClient = require('mongodb').MongoClient
const dbName = process.env.NODE_ENV === 'dev' ? 'database-test' : 'database'
const url = `mongodb://${process.env.MONGO_INITDB_ROOT_USERNAME}:${process.env.MONGO_INITDB_ROOT_PASSWORD}@${dbName}:27017?authMechanism=SCRAM-SHA-1&authSource=admin`
const options = {
useNewUrlParser: true,
reconnectTries: 60,
reconnectInterval: 1000
@torchhound
torchhound / routes.js
Last active November 3, 2018 02:54
mongo-crud routes/routes.js
const express = require('express')
const Document = require('../models/Document')
const router = express.Router()
router.get('/documents/all', (req, res, next) => {
req.app.locals.db.collection('documents').find({}).toArray((err, result) => {
if (err) {
res.status(400).send({'error': err})
}
@torchhound
torchhound / Document.js
Created November 1, 2018 01:10
mongo-crud models/Document.js
module.exports = class Document {
constructor(title, username, body) {
this.title = title
this.username = username
this.body = body
}
}
@torchhound
torchhound / .dockerignore
Created November 1, 2018 19:01
mongo-crud .dockerignore
.env
node_modules/
data/
LICENSE
README.md
.gitignore
.git/
example.env
.travis.yml
docker/
@torchhound
torchhound / .gitignore
Created November 1, 2018 19:02
mongo-crud .gitignore
.env
node_modules/
data/
docker/data/
@torchhound
torchhound / example.env
Created November 1, 2018 19:03
mongo-crud example.env
MONGO_INITDB_ROOT_USERNAME=example
MONGO_INITDB_ROOT_PASSWORD=example
MONGO_INITDB_DATABASE=api
MONGO_DATA_DIR=/data/db
MONGO_TEST_DATA_DIR=/data/test_db
MONGO_LOG_FILE=/var/log/mongodb/mongodb.log
PORT=80