by alexander white ©
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN}); | |
const {createHmac} = await import('crypto'); | |
const safeCompare = require('safe-compare'); | |
// Expo request signature check | |
const hmac = createHmac('sha1', process.env.SECRET_WEBHOOK_KEY); | |
hmac.update(Buffer.from(JSON.stringify(context.params))); | |
const hash = `sha1=${hmac.digest('hex')}`; | |
console.log('context.params', context.params) |
Ionic and ngCordova upload example |
Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.
You'll probably figure this out the hard way. When you run sudo apt-get update
, it will eventually report these errors:
Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
404 Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
404 Not Found [IP: 91.189.91.15 80]
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
I was asked how I deal with validation / create and update validation rulesets. Well here is one method I have used. Don't be afraid to build on top of what the framework has already given you. In my projects I use a base class for almost anything. You never know when you want your classes to inherit some common functionality. My BaseValidator
actually has some pretty useful methods and properties in it.
<?php
namespace FooProject\Internal\Validators;
use FooProject\Internal\Sanitizers\BaseSanitizer;
Handlebars.registerHelper('pagination', function(currentPage, totalPage, size, options) { | |
var startPage, endPage, context; | |
if (arguments.length === 3) { | |
options = size; | |
size = 5; | |
} | |
startPage = currentPage - Math.floor(size / 2); | |
endPage = currentPage + Math.floor(size / 2); |
- node.js
- Installation paths: use one of these techniques to install node and npm without having to sudo.
- Node.js HOWTO: Install Node+NPM as user (not root) under Unix OSes
- Felix's Node.js Guide
- Creating a REST API using Node.js, Express, and MongoDB
- Node Cellar Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
- JavaScript Event Loop
- Node.js for PHP programmers
var Template = function(opts) { | |
this.name = opts.name; | |
}; | |
Template.prototype.load = function(cb) { | |
var self = this; | |
cb = cb || function() {}; | |
var req = $.ajax({ | |
url: "/templates/" + this.name + ".handlebars" | |
}); |