Skip to content

Instantly share code, notes, and snippets.

View kshirish's full-sized avatar
👨‍💻

k kshirish

👨‍💻
View GitHub Profile
@kshirish
kshirish / App.jsx
Created June 9, 2023 03:43
Dynamic render through JSON schema
import * as React from "react";
const Text = (props) => {
return (
<div style={{ border: "1px solid red", padding: "20px" }}>
<p>this is text</p>
<div>{props.children}</div>
</div>
);
};
@kshirish
kshirish / settings.json
Created August 24, 2021 13:51
vscode settings
{
"editor.snippetSuggestions": "top",
"editor.suggestSelection": "first",
"editor.cursorSmoothCaretAnimation": false,
"editor.smoothScrolling": true,
"editor.fontSize": 14,
"editor.fontFamily": "Monaco",
"editor.fontWeight": "bold",
"editor.formatOnSave": true,
"emmet.triggerExpansionOnTab": true,
@kshirish
kshirish / play.ts
Created July 10, 2020 10:37
Learning typescript
// Typescript Documentation:
// https://www.typescriptlang.org/docs/
// Basic Types
const message: string = "Hello world";
const messageArr: Array<string> = [message];
console.log(message);
console.log(messageArr);
const isValid: boolean = false;
@kshirish
kshirish / rxjs.js
Last active March 4, 2019 11:40
Hands on RxJS
// https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.5/dist/global/Rx.umd.js
Rx.Observable.create(function(observer) {
let counter = 0;
setInterval(function() {
observer.next((counter += 2));
}, 2000);
}).subscribe(
function(val) {
@kshirish
kshirish / acl.js
Created February 21, 2018 16:30
Access Control
// users
const users = [
{
id: 0,
name: "Rocky"
},
{
id: 1,
name: "John"
},
@kshirish
kshirish / firebase.html
Created August 7, 2015 08:02
firebase go through
<!DOCTYPE html>
<html>
<head>
<title>firebase</title>
</head>
<body>
<script src='https://cdn.firebase.com/js/client/2.2.1/firebase.js'></script>
<script>
// var ref = new Firebase('https://test231.firebaseio.com/');
@kshirish
kshirish / promise.js
Last active August 29, 2015 14:22
Promises in native Javascript
var asyncFun = function(someUrl, resolve, reject) {
$.get(someUrl)
.done(function(response) {
if(response) {
resolve(response);
} else {
@kshirish
kshirish / es6.js
Last active August 29, 2015 14:18
// Arrows
// A function shorthand that binds `this` value.
// Arrow functions are always anonymous.
//
// // Basic syntax:
// (param1, param2, paramN) => { statements }
// (param1, param2, paramN) => expression
// equivalent to: => { return expression; }
// Parentheses are optional when there's only one argument:
// Airnb's style guide for writing better javascript
// Reference: https://github.com/airbnb/javascript
// Primitives
const foo = 1;
let bar = foo;
bar = 9;
console.log(foo, bar); // => 1, 9
// Reference: http://www.html5rocks.com/en/tutorials/es6/promises/
// `Promises` have been introduced natively as a part of ES6 now. In this blogpost hopefully I will
// try to explore all the aspects of `Promises`.
// So what is a Promise?
// `Promises` are merely a prettier way of writing code which makes an asynchronous code look like synchronous.
// Usual way of XHR
$.get("script.php", function(data) {
console.log('Your account has been created successfully!');