Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Loving Typescript ...

Abhas Bhattacharya bendtherules

💭
Loving Typescript ...
View GitHub Profile
@bendtherules
bendtherules / example.js
Created Nov 14, 2020
property-reference-readspecwithus- example
View example.js
obj = {
a: 123,
get ab() {return 456},
get abc() {return this.a},
}
obj.a
obj["a"+"b"]
@bendtherules
bendtherules / spec-not-found-sections.json
Last active Jun 30, 2020
Section ids used in engine262 which are now invalid
View spec-not-found-sections.json
[
"sec-numeric-types-bigint-unsighedRightShift",
"sec-allocatedtypedarray",
"sec-typedarray-species-create",
"sec-running-execution-context",
"sec-evaluate-expression-key-property-access",
"sec-evaluate-identifier-key-property-access"
]
@bendtherules
bendtherules / IsPropertyReference.js
Last active Mar 19, 2020
IsPropertyReference? - Example for foo.bar() article
View IsPropertyReference.js
// IsPropertyReference?
// 1. Different notations for accessing a property name
foo.bar() // ✅
foo["any string here"]() // ✅
// 2 Property name can also be a symbol - inbuilt or custom
someArray[Symbol.iterator].toString() // ✅
@bendtherules
bendtherules / try.graphql
Last active May 23, 2019
github_graphql
View try.graphql
{
repositoryOwner(login: "bendtherules") {
repositories(first: 100, isFork: true) {
nodes {
id
nameWithOwner
refs(refPrefix: "refs/heads/", last: 100) {
edges {
node {
branchName: name
View test1.css
*{background:#5d3a3a;margin:0;}p{width:200px;height:200px;background:#b5e0ba;}
@bendtherules
bendtherules / ruleSlow.js
Last active Mar 19, 2019
Slow down getStatus request
View ruleSlow.js
// change to slow down get order status
module.exports = {
summary: 'slow down placing order (https)',
*beforeDealHttpsRequest(requestDetail) {
return true;
},
*beforeSendRequest(requestDetail) {
const newRequestOptions = requestDetail.requestOptions;
// set rejectUnauthorized as false
newRequestOptions.rejectUnauthorized = false;
@bendtherules
bendtherules / hooks-demo.jsx
Created Jan 20, 2019
Demo code with react hooks
View hooks-demo.jsx
import { useState } from 'react';
function Example() {
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
View todo_implicit_1.js
class TODOList {
...
...
addNewTodo(todoText){
this.todos. ??
}
}
@bendtherules
bendtherules / install_c_for_python_compilation.txt
Last active Sep 16, 2020
How to install C compiler for python ( compile c+python modules from pip and also from cython)
View install_c_for_python_compilation.txt
install Microsoft Visual C++ Compiler for Python 2.7
create this fake folder "C:\Users\ab\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\fake1\fake2"
set env var VS90COMNTOOLS= that fake folder
now goto C:\Users\ab\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0
youll find there is vcvarsall.bat, but it is not searched for here
copy it and paste in the VC folder
open for editing:
[in 3 places youll find this type of statement, replace them with these]
set VCINSTALLDIR=%~dp0
View save_user_pass.py
from flask import Flask
from flask import *
# import redis
app = Flask(__name__)
fname = r"E:/much.txt"
# db = redis.StrictRedis(host='localhost', port=6379, db=0)
# db.client_setname("Url_shortener")
# db_list_user_name = "user"