Skip to content

Instantly share code, notes, and snippets.

@alxblog
alxblog / index.html
Created September 5, 2018 14:14 — forked from decors/index.html
Electron open-file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Electron</title>
</head>
<body>
<script>
var ipc = require('ipc');
@alxblog
alxblog / nirCheck.js
Created June 28, 2018 13:17
NIR Check (validation de numéro de sécurité sociale francaise)
var checkNIR = function(nir){
nir = (typeof nir === "string" ) ? nir : nir.toString();
var checkSum = parseInt(nir.substring(13), 10);
var ssNbr = parseInt(nir.substring(0,13), 10);
var calculateCheckSum = Math.abs((ssNbr % 97) - 97);
return (checkSum == calculateCheckSum) ? true : false;
}
if(checkNIR("188119206408654")){
console.log("NIR Verified")
@alxblog
alxblog / Order.php
Created December 13, 2016 14:12
Prestashop 1.6.1.0 Webservice filter by current_status fix
<?php
/**
* @author esuaram
* Fix for PSCSX-5578
* With pull request: https://github.com/xGouley/PrestaShop/commit/d3a0483d06254fc2e20d439b855f5ea4240ca3d7
* File location: /override/classes/order/Order.php
*/
class Order extends OrderCore
{
public function getWsCurrentState()
@alxblog
alxblog / install-mongodb.md
Created June 12, 2016 18:00 — forked from adamgibbons/install-mongodb.md
Install MongoDB on Mac OS X 10.9

Install MongoDB with Homebrew

brew install mongodb
mkdir -p /data/db

Set permissions for the data directory

Ensure that user account running mongod has correct permissions for the directory:

@alxblog
alxblog / app.js
Created June 12, 2016 17:18 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@alxblog
alxblog / better-nodejs-require-paths.md
Created June 3, 2016 16:22 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions