Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Building cssbattle.dev

Kushagra Gour chinchang

🏠
Building cssbattle.dev
View GitHub Profile
View relative-time-format.js
new Intl.RelativeTimeFormat('en', {
style: 'narrow'
}).format(-10, 'day')
// "10 days ago"
new Intl.RelativeTimeFormat('en', {
style: 'narrow'
}).format(10, 'day')
// "in 10 days"
@chinchang
chinchang / plural-units.js
Created May 25, 2020
Handling singular/plural for number units
View plural-units.js
new Intl.NumberFormat(undefined, {
style: "unit",
unit: 'kilometer',
unitDisplay: 'long'
}).format(10)
//"10 kilometres"
new Intl.NumberFormat(undefined, {
style: "unit",
unit: 'kilometer',
@chinchang
chinchang / currency-number-formatting.js
Created May 24, 2020
Formatting a number as currency
View currency-number-formatting.js
new Intl.NumberFormat(undefined, {
style: 'currency',
currency: 'INR'
}).format(23213)
//"₹23,213.00"
new Intl.NumberFormat('de-DE', {
style: 'currency',
currency: 'EUR'
}).format(23213)
@chinchang
chinchang / compact-number-formatting.js
Created May 23, 2020
Formatting numbers into approximate compact form
View compact-number-formatting.js
new Intl.NumberFormat(undefined, {
notation: 'compact'
}).format(12200);
// "12K"
new Intl.NumberFormat(undefined, {
notation: 'compact'
}).format(12534200);
// "13M"
View for-async-await.js
async function loop() {
for (let i = 0; i < 10; i++) {
document.body.innerHTML += i + " ";
await waitForEvent();
}
}
function waitForEvent() {
return new Promise(resolve => {
window.onclick = () => {
@chinchang
chinchang / remote-first-tech-companies
Created Oct 1, 2019
List of good remote first companies in tech
View remote-first-tech-companies
- DuckDuckgo - https://duckduckgo.com/hiring/
- Gitlab - https://about.gitlab.com/jobs/
- Invision - https://www.invisionapp.com/about/#jobs
- Automattic - https://automattic.com/work-with-us/
- Doist - https://doist.com/jobs/
- Zapier - https://zapier.com/jobs/
- Gatsby - https://www.gatsbyjs.com/careers/
- Netlify - https://www.netlify.com/careers/
- Airbase - https://angel.co/company/airbase-1/jobs
- Hasura - https://hasura.io/careers
View c-exercises.md

Program 1

  • Take a sentence as input from user
  • Calculate and show: sentence's length, number of vowels.

Program 2

  • Take a number n between 5-20 as input from user
  • Create an array of length n
  • Put random number (1-100) in each element of the array
  • Display the array's element by comma separated. Eg. 1,56,2,88,2
  • Show the sum of the all the elements of the array
@chinchang
chinchang / endpoint.js
Created Feb 26, 2019
Now lambda issue
View endpoint.js
const PixelDiff = require('pixel-diff')
module.exports = async (req, res) => {
res.statusCode = 200
res.setHeader('Content-Type', `text/plain`)
res.setHeader('Cache-Control', 'no-cache')
res.end('done!')
}
@chinchang
chinchang / game.html
Last active Mar 23, 2020
A simple game for my talk at GDG devfest '18
View game.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<style id="webmakerstyle">
body {
padding: 0;
margin: 0;
@chinchang
chinchang / mac-setup
Last active Aug 26, 2019
Steps to setup my mac machine
View mac-setup
Steps to setup mac osx
- Finish onboarding
## System Tweaks
- increase key repeat rate (Preference > Keyboard)
- increase trackpad speed (Preferences > Trackpad)
- enable 3-finger drag (Preferences > Accessibility)
- Disable "swipe between pages" (Preferences > Tackpad > More gestures)