For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
#![allow(unused)] // silence unused warnings while exploring (to comment out) | |
use sqlx::postgres::{PgPoolOptions, PgRow}; | |
use sqlx::{FromRow, Row}; | |
// Youtube episode: https://youtu.be/VuVOyUbFSI0 | |
// region: Section | |
// Start postgresql server docker image: |
extern crate serde; | |
use base64; | |
use hex::FromHex; | |
use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; | |
use std::convert::TryFrom; | |
#[derive(Serialize, Deserialize, Debug)] | |
pub struct Config { | |
#[serde(serialize_with = "as_base64", deserialize_with = "from_base64")] | |
key: [u8; 32], |
// This approach is based on the one devised in | |
// http://xion.io/post/programming/gisht-recap.html by Karol | |
// Kuczmarski; it permits a nice, easy-to-use API while still | |
// allowing you to inject doubles behind the scenes. | |
// | |
// As an example, this is in main.rs: | |
// | |
// let mut grepper = Grepper::new(config.filename); | |
// if let Err(e) = grepper.run() { | |
// ... |
This TRIGGER function calls PosgreSQL's NOTIFY
command with a JSON payload. You can listen for these calls and then send the JSON payload to a message queue (like AMQP/RabbitMQ) or trigger other actions.
Create the trigger with notify_trigger.sql.
When declaring the trigger, supply the column names you want the JSON payload to contain as arguments to the function (see create_triggers.sql)
The payload returns a JSON object:
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.
- Go to: https://twitter.com/{username}/likes
- Open the console and run the following JavaScript code:
setInterval(() => {
for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
d.click()
}
I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.
But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.
Svelte is a language.
Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?
A few projects that have answered this question:
// Backtracking + DFS solution | |
// Time: O(2 ^ n), 29ms | |
// Space: O(n) for there will be only n recursion calls (excluding result), 41.6mb | |
class Solution { | |
List<List<Integer>> ans; | |
public List<List<Integer>> combine(int n, int k) { | |
ans = new ArrayList<>(); | |
combineR(n, k, 1, new ArrayList<>()); | |
return ans; | |
} |
import React from 'react'; | |
import { mount } from 'enzyme'; | |
let WidgetLayout; | |
/* eslint-disable react/display-name, react/prop-types */ | |
beforeEach(() => { | |
jest.resetModules(); | |
}); |