Skip to content

Instantly share code, notes, and snippets.

View Easy-Cloud-in's full-sized avatar
🐌
I may be slow to respond.

Sakar SR Easy-Cloud-in

🐌
I may be slow to respond.
View GitHub Profile
const one = +true; //This would return 1 (Unary and boolean operator)
const zero = +false; // This would return 0 (Unary and boolean operator)
//Using string operations apending 1 and 0 and 0 to form "100"
const hundredInString = one.toString() + zero.toString() + zero.toString();
// To save the day for not using the loop, we are using recursion function.
const printInRecursion = (index) => {
if (index <= parseInt(hundredInString)) {
console.log(index);
printInRecursion(index + one);

Ten seconds to ponder if a thread is worth it

recording

A userstyle that makes you wait ten seconds before entering a Hacker News thread. I use stylus to manage mine.

.subtext {
  display: inline-block;
 background: linear-gradient(to left, transparent 50%, #f60 50%) right;
@noseratio
noseratio / async-generator.js
Last active March 28, 2021 22:09
Async generators and "for await" in JavaScript
// by @noseratio
// https://twitter.com/noseratio/status/1297517388552757249?s=20
// gist: https://gist.github.com/noseratio/721fea7443b74a929ea93c8f6a18cec4/edit
// RunKit: https://runkit.com/noseratio/async-generators-and-for-await-in-javascript
async function delay(ms) {
await new Promise(r => setTimeout(r, ms));
return ms;
}
@loicpw
loicpw / index.html
Created January 18, 2019 00:57
Responsive Web Design Projects - Build a Survey Form
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<!--
Hello Camper!
For now, the test suite only works in Chrome! Please read the README below in the JS Editor before beginning. Feel free to delete this message once you have read it. Good luck and Happy Coding!
- The freeCodeCamp Team
@ljayz
ljayz / readme.txt
Last active July 13, 2024 16:08
Fix aws codecommit unable to access repository (The requested URL returned error: 403) in windows
this was tested using windows10 pro
when cloning a git this error was produced
fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/RepositoryName': The requested URL returned error: 403
to fix add the following git configuration
git config --global credential.helper "!aws codecommit credential-helper $@"
git config --global credential.UseHttpPath true
check if git has system credential.helper by typing
@philmerrell
philmerrell / audio.service.ts
Created November 20, 2017 21:10
Angular audio service class
import { Injectable } from '@angular/core';
import { Observable, BehaviorSubject } from 'rxjs/Rx';
@Injectable()
export class AudioService {
public audio: HTMLAudioElement;
public timeElapsed: BehaviorSubject<string> = new BehaviorSubject('00:00');
public timeRemaining: BehaviorSubject<string> = new BehaviorSubject('-00:00');
public percentElapsed: BehaviorSubject<number> = new BehaviorSubject(0);
@tjoskar
tjoskar / stream-context.directive.ts
Last active August 29, 2021 04:33
How to use observables in angular 2 template
import { Directive, Input, TemplateRef, ViewContainerRef, EmbeddedViewRef, ChangeDetectorRef } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
@Directive({
selector: '[streamContext][streamContextOn]'
})
export class StreamContext {
@Input() streamContextOn: Observable<any>;
templateRef: TemplateRef<any>;
@jsjohnst
jsjohnst / mongo_disk_usage.js
Last active November 21, 2020 05:48
Calculate total disk usage by MongoDB. storageSize is the actual used space, totalSize is the amount of disk space allocated.
db = db.getSiblingDB("admin");
dbs = db.runCommand({ "listDatabases": 1 }).databases;
storageSize = 0;
totalSize = 0;
dbs.forEach(function(database) {
db = db.getSiblingDB(database.name);
stats = db.stats();