This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
class BitArray(bytearray): | |
mask_for = [2**i for i in range(8)] | |
inverse_mask_for = [256 - 2**i for i in range(8)] | |
valid_values = (0, 1) | |
def __init__(self, source, *args, **kwargs) -> None: | |
if isinstance(source, int): | |
source = source/8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gql import gql | |
def create_graphql_query(repo: str, commit_id: str): | |
""" | |
Create a GraphQL query | |
Documentation: https://docs.github.com/en/graphql | |
""" | |
return gql(f'''query {{ | |
search( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Parvez M Robin | |
* [email protected] | |
* Date: Apr 04, 2019 | |
*/ | |
import React from 'react'; | |
import CreatableSelect from 'react-select/creatable'; | |
import PropTypes from 'prop-types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use((request, response, next) => { | |
// wheather `req.write` / `req.send` / `req.json`, express calls underlying `socket.write` | |
// thus intercepting `socket.write` | |
const backup = response.socket.write; | |
let code; | |
function newWriter(...args) { | |
for (const arg of args) { | |
if (typeof arg === 'string') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {createContext, useState} from 'react'; | |
import firebase from '../firebase'; | |
export const ChatContext = createContext(); | |
const ChatContextProvider = (props) => { | |
//Firebase settings | |
const DB = firebase.firestore(); | |
const chatRef = DB.collection("chats"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("1"); | |
setTimeout(() => { | |
console.log("2"); | |
setTimeout(() => { | |
console.log("3"); | |
}, 0); | |
console.log("4"); | |
}, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
City | Gender | Income | Illness | |
---|---|---|---|---|
Dallas | Male | 40367 | No | |
Dallas | Female | 41524 | Yes | |
Dallas | Male | 46373 | Yes | |
New York City | Male | 98096 | No | |
New York City | Female | 102089 | No | |
New York City | Female | 100662 | No | |
New York City | Male | 117263 | No | |
Dallas | Male | 56645 | Yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require('lodash'); | |
const parser = s => { | |
const parts = s.split(':'); | |
return parts[0] * 60 + +parts[1] | |
}; | |
const doesOverlap = (slot, booking) => { | |
if (!slot || !booking) { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
var marks = map[string]int{ | |
"sakeef": 95, | |
"oishie": 82, | |
"robin": 61, | |
"mim": 43, | |
} | |
println(marks["sakeef"], marks["oishie"], marks["robin"], marks["mim"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
var marks = map[string]int{} | |
marks["sakeef"] = 95 | |
marks["oishie"] = 82 | |
marks["robin"] = 61 | |
marks["mim"] = 43 | |
delete(marks, "sakeef") |
NewerOlder