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
{
"Seti_ClosedFolder_dots": true,
"Seti_ClosedFolder_remove": true,
"Seti_ClosedFolder_same": true,
"Seti_SB_big": true,
"Seti_SB_bright": true,
"Seti_SB_med": true,
"Seti_pad_3": true,
"Seti_pad_5": true,
"Seti_rainbow": true,
# 300 5 MIN
# 600 10 MIN
# 900 15 MIN
# 1800 30 MIN
# 2700 45 MIN
# 3600 1 HR
# 7200 2 HR
# 10800 3 HR
# 14400 4 HR
# 18000 5 HR
@PriteshJain
PriteshJain / trex.html
Created March 30, 2015 11:21
T-Rex game from Chrome offline mode. Download and open in Chrome browser (Runs only on Chrome)
<html i18n-values="dir:textdirection;lang:language" dir="ltr" lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, user-scalable=no">
<title i18n-content="title">T-Rex Game</title>
<style>/* Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. */
a {
# 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;
@PriteshJain
PriteshJain / rails_11776.rb
Last active January 3, 2016 02:59
rails#11776 AR::Store attributes inaccessible after destruction of object
gem 'activerecord', '=4.0.0' #Works Fine
# gem 'activerecord' , '=4.0.1' #CAUSES ActiveModel::MissingAttributeError: missing attribute: group_id
# gem 'activerecord', '=4.0.2' #CAUSES ActiveModel::MissingAttributeError: missing attribute: group_id
require 'active_record'
# require 'sqlite3'
require 'mysql2'