Skip to content

Instantly share code, notes, and snippets.

View tolumide-ng's full-sized avatar

Tolumide Shopein tolumide-ng

  • Ex-Andela
  • Berlin, Germany
  • 09:15 (UTC -12:00)
View GitHub Profile
@tolumide-ng
tolumide-ng / README.md
Created January 9, 2023 19:30 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@jeremychone
jeremychone / rust-xp-02-postgresql-sqlx.rs
Created May 11, 2021 05:48
Rust to PostgreSQL with SQLX | Rust By Example
#![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:
@ripx80
ripx80 / main.rs
Created March 24, 2021 14:19
example for serde to implement serialize_with and deserialize_with for a u8 array
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],
@spinnylights
spinnylights / lib.rs
Last active December 11, 2020 11:56
Rust book "minigrep" project: test doubles + spies
// 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() {
// ...
@goliatone
goliatone / README.md
Last active March 14, 2024 13:10 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload

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:

@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active May 6, 2024 13:21
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active May 7, 2024 08:28
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

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:

@yitonghe00
yitonghe00 / 77. Combinations (#1 Backtracking +DFS).java
Last active September 5, 2022 02:06
77. Combinations (https://leetcode.com/problems/combinations/description/): Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
// 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;
}
@nlucero
nlucero / widget-layout.test.js
Created May 16, 2018 13:58
Jest doMock example
import React from 'react';
import { mount } from 'enzyme';
let WidgetLayout;
/* eslint-disable react/display-name, react/prop-types */
beforeEach(() => {
jest.resetModules();
});