Skip to content

Instantly share code, notes, and snippets.

View pniel-cohen's full-sized avatar

Pniel (Pini) Cohen pniel-cohen

View GitHub Profile
@pniel-cohen
pniel-cohen / magento1_enterprise_index_diagnostics.sql
Created March 16, 2017 10:58 — forked from mttjohnson/magento1_enterprise_index_diagnostics.sql
Magento 1.x Enterprise Partial Indexing Diagnostics Toolset
-- When products are added/removed from a category this table stores all the relation data
select * from catalog_category_product where product_id = '24526';
-- The index that is used for presenting products in a category on the frontend
select * from catalog_category_product_index where product_id = '24526';
-- The change log table used for Magento EE partial index functionality
select * from catalog_category_product_index_cl where product_id = '24526' and version_id > (select version_id from enterprise_mview_metadata where changelog_name = 'catalog_category_product_index_cl');
@pniel-cohen
pniel-cohen / app.module.ts
Last active November 18, 2019 20:18 — forked from katowulf/app.component.ts
Dynamically set page title based on active route in Angular 4
import ...
@NgModule({
...
providers: [ TitleService ],
})
export class AppModule {
constructor(titleService: TitleService) {
titleService.init();
}
@pniel-cohen
pniel-cohen / LoginController.js
Created August 1, 2018 13:48 — forked from psi-4ward/LoginController.js
Sails.JS JWT Auth
// controllers/LoginController.js
module.exports = {
index: function(req, res) {
var email = req.param('email');
var password = req.param('password');
// delay everthing to prevent bruteforce, dos and timing attacks
setTimeout(function() {
@pniel-cohen
pniel-cohen / isracard.js
Created May 11, 2020 13:52 — forked from etodanik/isracard.js
Checks the validity of a given Isracard credit card number
function isracardCheck(num) {
if(num.length < 8 || num.length > 9) return false;
var diff = "987654321",
sum = 0,
a = 0,
b = 0,
c = 0;
if(num.length < 9) num = "0" + num;
for(var i=1;i<9;i++){
sum += parseInt(diff.substr(i,1))*parseInt(num.substr(i,1));