0x2bfa3a690b88f51c03ddf63e16d9ce55818ca417e6f52adb4b0ab326572bb9e3
| export async function tryGetRevertReason(to: string, from: string, data: string): Promise<string | undefined> { | |
| const provider = ethers.getDefaultProvider(); | |
| const tx = { to, from, data }; | |
| try { | |
| await provider.estimateGas(tx); | |
| } catch { | |
| const value = await provider.call(tx); | |
| return hexDataLength(value) % 32 === 4 && hexDataSlice(value, 0, 4) === '0x08c379a0' | |
| ? defaultAbiCoder.decode(['string'], hexDataSlice(value, 4)) | |
| : undefined; |
There are two main modes to run the Let's Encrypt client (called Certbot):
- Standalone: replaces the webserver to respond to ACME challenges
- Webroot: needs your webserver to serve challenges from a known folder.
Webroot is better because it doesn't need to replace Nginx (to bind to port 80).
In the following, we're setting up mydomain.com.
HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.
| import { Injectable } from "@angular/core"; | |
| import { ReplaySubject, Observable } from "rxjs/Rx"; | |
| interface Message { | |
| channel: string; | |
| data: any; | |
| } | |
| @Injectable() | |
| export class MessageBus { |
| /(?<=\s|:)\(?(?:(0?[1-3]\d{1,2})\)?(?:\s|-)?)?((?:\d[\d-]{5}|15[\s\d-]{7})\d+)/ |
| /(?<=\s|:)\(?(?:(0?[1-3]\d{1,2})\)?(?:\s|-)?)?((?:\d[\d-]{5}|15[\s\d-]{7})\d+)/ |
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.
This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.
It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)
Gists don't let you specify full paths, so in the project structure the files would be:
routes-index.js --> /routes/index.js // modified to add the api endpoints
routes-api-posts.js --> /routes/api/posts.js // new file containing the Post API route controllers
| #!/bin/bash | |
| #Install Laravel Homestead (http://laravel.com/docs/5.0/homestead) | |
| #ssh into Homestead "homestead ssh" | |
| #Run the script using "sudo bash homestead_extras.sh" | |
| #Leave all the default options sugested during the installation, and do not modify any files!! | |
| apt-get update | |
| #Additional Packages | |
| apt-get install -y php5-ldap php5-mssql |
| angular.module('utils.filters', []) | |
| .filter('removeAccents', removeAccents); | |
| function removeAccents() { | |
| return function (source) { | |
| var accent = [ | |
| /[\300-\306]/g, /[\340-\346]/g, // A, a | |
| /[\310-\313]/g, /[\350-\353]/g, // E, e | |
| /[\314-\317]/g, /[\354-\357]/g, // I, i | |
| /[\322-\330]/g, /[\362-\370]/g, // O, o |