Skip to content

Instantly share code, notes, and snippets.

View Shahzad6077's full-sized avatar
🔥
Focusing

Muhammad Shahzad Ali Shahzad6077

🔥
Focusing
View GitHub Profile
@leodutra
leodutra / latin1-letter-regex.js
Created July 4, 2012 00:20
Basic Latin-1 Letter Regular Expression (JavaScript)
(/[A-z\u00C0-\u00ff]+/g)
@mccahill
mccahill / config.js
Last active November 18, 2021 19:00 — forked from jeffrafter/server.js
Example of a node OAuth (Twitter) and OAuth2 (Google Calendar) client that works with the version 3 Express framework. This assumes you have a config.js file holding the keys and secrets
module.exports = {
'HOSTPATH': 'http://your.host.here',
'PORT': 80,
'EXPRESS_SESSION_SECRET': '123456',
'TWITTER_CONSUMER_KEY': 'your-consumer-key-here',
'TWITTER_CONSUMER_SECRET': 'your-secret-here',
'GOOGLE_APP_ID': 'your-app-id-here',
'GOOGLE_CONSUMER_SECRET': 'your-consumer-secret-here',
};
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active June 30, 2024 04:14
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@vybstat
vybstat / ds_store_removal
Last active July 2, 2024 13:23
How to remove .DS_Store file from GitHub that Mac OS X creates
# remove .DS_Store file from GitHub that MAC OS X creates
# find and remove .DS_Store
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
# create .gitignore file, if needed
touch .gitignore
echo .DS_Store > .gitignore
# push changes to GitHub
@parmentf
parmentf / GitCommitEmoji.md
Last active July 23, 2024 11:27
Git Commit message Emoji
@stekhn
stekhn / weightedMean.js
Last active November 20, 2022 03:49
Weighted arithmetic mean (average) in JavaScript
function weightedMean(arrValues, arrWeights) {
var result = arrValues.map(function (value, i) {
var weight = arrWeights[i];
var sum = value * weight;
return [sum, weight];
}).reduce(function (p, c) {
@odigity
odigity / Firebase Database API Cheatsheet
Last active June 9, 2022 03:45
Firebase Database API Cheatsheet
There is no way to store an empty object/array/null value.
There are also no actual arrays. Array values get stored as objects with integer keys.
(If all keys are integers, it will be returned as an array.)
Basically, it's one giant tree of hashes with string keys.
Simply write a value to any location, and the intermediary locations will automatically come into existance.
── Classes ──
DataSnapshot : Container for a subtree of data at a particular location.
@akirattii
akirattii / sse-serverside-example.js
Last active April 26, 2024 11:15
Server-Sent Events nodejs example. This shows how to detect the client disconnection.
var express = require('express');
var app = express();
// response header for sever-sent events
const SSE_RESPONSE_HEADER = {
'Connection': 'keep-alive',
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'X-Accel-Buffering': 'no'
};
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 24, 2024 08:58
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active July 21, 2024 20:48
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes