Skip to content

Instantly share code, notes, and snippets.

@manitgupta
manitgupta / gist:6cf699ec655805cc51a0927bfc6e184f
Created September 17, 2022 13:26
jugaad trader sample code
from datetime import date, timedelta
from jugaad_data.nse import bhavcopy_save
from mysql_details import mydb
from mysql_details import cursor
import pandas as pd
from tenacity import retry, stop_after_attempt
from jugaad_trader import Zerodha
from sqlalchemy import create_engine
import urllib.parse
import pprint as pp
@JohnBra
JohnBra / useStorage.tsx
Created July 4, 2022 22:44
Typed React useStorage hook for chrome extensions
import { Dispatch, SetStateAction, useState, useEffect, useCallback, useRef } from 'react';
export type StorageArea = 'sync' | 'local';
// custom hook to set chrome local/sync storage
// should also set a listener on this specific key
type SetValue<T> = Dispatch<SetStateAction<T>>;
/**
# frozen_string_literal: true
class CrazyPage < BasePage
class CrazyParentSection< BasePage
custom_text_field(:crazy_text, index: 1)
end
page_section(:crazy_parent, CrazyParentSection, class: 'class1 class2 class3', visible_text: 'Name')
# now in your step def, you can call
@schacon
schacon / docker-compose.yml
Created August 15, 2021 19:15
Docker Compose file for ruby, postgres and redis
version: '3'
services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
args:
VARIANT: 2.6
NODE_VERSION: "lts/*"
volumes:
@ih2502mk
ih2502mk / list.md
Last active June 27, 2024 15:25
Quantopian Lectures Saved
@skkim7821
skkim7821 / machine.js
Last active September 21, 2021 10:13
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@alistairtweed
alistairtweed / .rspec
Last active May 9, 2024 22:02
Testing Rails with RSpec, Factory Bot, Faker and Shoulda Matchers
--require spec_helper
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@nileshtrivedi
nileshtrivedi / composable_web.md
Last active January 10, 2022 04:31
My thoughts on making the Web more composable like UNIX

The Composable Web Proposal

Serverless infrastructure like AWS Lambda and Google Cloud Functions have made it much cheaper for developers to offer server-side code for public consumption without keeping a server always running.

If these functions could be declared as stateless or deterministic, costs can be brought down even more because only the first invocation needs to be executed. Cached response could be returned for future invocations with the same input arguments.

All modern browsers support URL lengths of thousands of characters, even on mobile. A lot of data can be embedded and passed around directly in the URLs (instead of passing identifiers which requires a look-up which costs server time).

So here's a thought: