Skip to content

Instantly share code, notes, and snippets.

View PriteshJain's full-sized avatar
☠️
Destructuring Requirements

Pritesh Jain PriteshJain

☠️
Destructuring Requirements
View GitHub Profile
router.get('/:page', (req, res) => {
let page = req.params.page; // page number
let limit = 50; // number of records per page
let offset = page * limit;
db.user.findAndCountAll({
attributes: ['id', 'first_name', 'last_name', 'date_of_birth'],
limit: limit,
offset: offset,
$sort: { id: 1 }
@PriteshJain
PriteshJain / install-comodo-ssl-cert-for-nginx.rst
Created December 31, 2016 00:11 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@PriteshJain
PriteshJain / Device Details
Created November 9, 2015 09:50 — forked from VenomVendor/Device Details
Get Device Details in Android Programmatically.
String details = "VERSION.RELEASE : "+Build.VERSION.RELEASE
+"\nVERSION.INCREMENTAL : "+Build.VERSION.INCREMENTAL
+"\nVERSION.SDK.NUMBER : "+Build.VERSION.SDK_INT
+"\nBOARD : "+Build.BOARD
+"\nBOOTLOADER : "+Build.BOOTLOADER
+"\nBRAND : "+Build.BRAND
+"\nCPU_ABI : "+Build.CPU_ABI
+"\nCPU_ABI2 : "+Build.CPU_ABI2
+"\nDISPLAY : "+Build.DISPLAY
+"\nFINGERPRINT : "+Build.FINGERPRINT
# updated from the original @ http://cheat.errtheblog.com/s/rspec_shoulda
# just a subset -- models -- is included here. I'll update this, and create cheat sheets for others, as I go along.
# I marked the ones I added with NEW and also added the links to the corresponding code, as I think it's useful.
# Any comments/corrections are welcome!
# ================= Data and Associations =======================
# https://github.com/thoughtbot/shoulda-matchers/tree/master/lib/shoulda/matchers/active_record
it { is_expected.not_to have_db_column(:admin).of_type(:boolean) }
it { is_expected.to have_db_column(:salary).
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.