Skip to content

Instantly share code, notes, and snippets.

View DroidNinja's full-sized avatar

Arun Sharma DroidNinja

View GitHub Profile
@NikolaDespotoski
NikolaDespotoski / ViewModelParameterizedProvider.kt
Last active August 12, 2019 08:11
ViewModelProvider that instantiates ViewModel with parameterized constructor
import android.arch.lifecycle.ViewModel
import android.arch.lifecycle.ViewModelProvider
import android.arch.lifecycle.ViewModelStore
import android.arch.lifecycle.ViewModelStores
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentActivity
import java.util.concurrent.atomic.AtomicBoolean
/**
* Created by Nikola on 7/19/2017.
@bambooom
bambooom / parallelQueries.js
Created July 1, 2016 02:39
async.parallel multiple sequelize queries
async.parallel({
card_count: function (cb) {
db
.Card
.findAll({
where: {course_id: 'some id'}
})
.then(function (results) {
var t = [];
results.forEach(function (result) {
@cerebrl
cerebrl / 1-securing-express.md
Last active August 2, 2023 22:48
Securing ExpressJS

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.

Backend Architectures

ARCHITECTURES

ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats

@jmyrland
jmyrland / test.js
Last active January 19, 2024 18:51
Socket-io load test?
/**
* Modify the parts you need to get it working.
*/
var should = require('should');
var request = require('../node_modules/request');
var io = require('socket.io-client');
var serverUrl = 'http://localhost';