Skip to content

Instantly share code, notes, and snippets.

View DominusKelvin's full-sized avatar
👨‍💻
Working remotely.

Kelvin Oghenerhoro Omereshone DominusKelvin

👨‍💻
Working remotely.
View GitHub Profile
@simonplend
simonplend / parseargs-example.mjs
Last active June 5, 2022 06:17
Example using new experimental Node.js parseArgs method (https://nodejs.org/api/util.html#utilparseargsconfig) - more new features covered at https://github.com/simonplend/whats-new-in-node-js-core
import { parseArgs } from "node:util";
const args = parseArgs({
options: {
name: {
type: "string",
},
verbose: {
type: "boolean",
short: "v",
@gaearon
gaearon / Classes.js
Created May 27, 2020 17:38
Beneath Classes: Prototypes
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
@IanColdwater
IanColdwater / twittermute.txt
Last active July 2, 2024 02:25
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@mikermcneil
mikermcneil / How to name a noun.md
Last active October 7, 2023 16:51
Naming conventions for things like variables, parameters, and attributes. (Naming nouns)

How to name a noun

Some of the naming conventions we use at Sails for nouns like variables, parameters, property names, config settings, database attributes/columns/fields, and so on.

Why bother?

Naming is hard. And naming conventions usually end up being wrong, or incomplete at best.

This may be an unpopular opinion, but in my experience, coming up with new methodologies for variables and such doesn't usually create a lot of value for an individual developer. So why bother?

@lira
lira / postman-update.sh
Last active October 26, 2023 11:16 — forked from jcharlier/postman-update.sh
Install/Update postman or postman canary (beta) for linux. Tested in ubuntu 17.10 gnome3
#!/bin/bash
cd /tmp || exit
read -r -p "[s]table or [b]eta? [sS/bB] " choice
choice=${choice,,} # tolower
if [[ ! "$choice" =~ ^(s|b)$ ]]; then
exit
fi
if [[ "$choice" = "s" ]]; then
url=https://dl.pstmn.io/download/latest/linux64
name=Postman
@sgress454
sgress454 / custom-blueprint.md
Last active March 5, 2022 06:05
Adding a custom blueprint action to all models

Reference: https://gitter.im/balderdashy/sails?at=58be4b1af1a33b62758d57ea

Is there anyway that I can add a method to all routes?

The issue

Given a Sails app with two models User and Pet, how do we create a single controller action foo and have it automatically run on requests for both /user/foo and /pet/foo?

The solution

@mikermcneil
mikermcneil / example-of-iterator-for-where-clause-of-stage-2-query-in-waterline-0.13-and-sails-v1.js
Last active August 17, 2022 12:48
example of iterator for the `where` clause from the `criteria` query key of a stage 2 query in waterline 0.13 / sails v1 (also works for stage 3 queries)
// ====================================================================================
// Example of iterating over the `where` clause from a stage 2 query from Waterline.
// (the example below attempts to demonstrate a few of the most useful guarantees)
//
// > Mostly pay attention to the structure. Other than that, you can safely assume
// > that, in short, everything is valid (+in a schema-aware way), guaranteed.
// ====================================================================================
/* ~%° before iterating */
@rxaviers
rxaviers / gist:7360908
Last active July 7, 2024 09:52
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@mikermcneil
mikermcneil / using-raw-socket-io-in-sails.js
Created September 17, 2013 18:32
Using raw socket.io functionality in a Sails.js controller
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@scaryguy
scaryguy / change_primary_key.md
Last active July 6, 2024 02:45
How to change PRIMARY KEY of an existing PostgreSQL table?
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of  your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;