Skip to content

Instantly share code, notes, and snippets.

View Bishwas-py's full-sized avatar
🎯
Focusing

Bishwas Bhandari Bishwas-py

🎯
Focusing
View GitHub Profile
@Bishwas-py
Bishwas-py / donations_live.html.heex
Created June 28, 2024 02:09
lib/live_view_studio_web/live/donations_live.html.heex
<h1>Food Bank Donations</h1>
<div id="donations">
<div class="wrapper">
<table>
<thead>
<tr>
<th class="item">
<.sort_link opts={@opts} sort_by={:item}>
Item
</.sort_link>
@Bishwas-py
Bishwas-py / donations_live.ex
Created June 28, 2024 02:09
lib/live_view_studio_web/live/donations_live.ex
defmodule LiveViewStudioWeb.DonationsLive do
use LiveViewStudioWeb, :live_view
alias LiveViewStudio.Donations
import LiveViewStudioWeb.SortComponents
def mount(_params, _session, socket) do
donations = Donations.list_donations()
socket =
@Bishwas-py
Bishwas-py / sort_components.ex
Created June 28, 2024 02:07
lib/live_view_studio_web/components/layouts/sort_components.ex
defmodule LiveViewStudioWeb.SortComponents do
use Phoenix.Component
def valid_sort_by(%{"sort_by" => sort_by}) do
String.to_atom(sort_by)
end
def valid_sort_by(_), do: :id
def toggled_sort_order(opts, sort_by) do
@Bishwas-py
Bishwas-py / charge.ts
Created March 23, 2024 14:42
redundant task in github
export async function charge_per_action(event: RequestEvent,
usage_title: string | null = null,
required_credit_amount = 2): Promise<MessageOut | null> {
if (!usage_title) {
usage_title = event.url.pathname;
}
try {
const response = await event.fetch(`$api/payout/charge/`, {
method: 'POST',
@Bishwas-py
Bishwas-py / find_error_with_error_loc.ts
Created January 9, 2024 09:16
django ninja/fastapi/pydantic loc errors to readable data
export type MessageType = 'success' | 'error' | 'warning' | 'info';
type MessageOutCommon = {
message_type?: MessageType
alias: string;
action_path?: string;
};
type MessageSingle = MessageOutCommon & {
message: string;
@Bishwas-py
Bishwas-py / mod-http-passenger.conf
Created July 21, 2022 06:36
mod-http-passenger.conf for rails app
### Begin automatically installed Phusion Passenger config snippet ###
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/ruby2.7;
### End automatically installed Phusion Passenger config snippet ###
@Bishwas-py
Bishwas-py / nginx-for-rails-app
Created July 21, 2022 06:35
Nginx Setup for Rails app
server {
listen 80;
listen [::]:80;
server_name _;
root /home/username/rails-app-name/public;
passenger_enabled on;
passenger_app_env production;
@Bishwas-py
Bishwas-py / boogle-game-algorithm.py
Created June 17, 2022 05:56
Boogle game Algorithm
import random
import data
import string
def find_word_rec(check_board, mn_board, word, possibleCoordinates, temp, pos_words=[], cur_step=1):
# print('temp', temp, 'word', word)
_x, _y = possibleCoordinates
@Bishwas-py
Bishwas-py / profile-with-camera-in-tailwind-css.js
Created June 9, 2022 16:26
Profile with camera in tailwind css
<div className={"space-y-2 grid place-items-center"}>
<div
className={"p-1 relative shadow-sm bg-gradient-to-b from-purple-500 to-fuchsia-500 w-48 h-48 rounded-full"}>
<img
className={"object-cover rounded-full w-full h-full"}
src={"https://cdn.bio.link/uploads/profile_pictures/2022-06-09/38zFuPFJBsmcuzHNbishwas.png"}/>
<div className="bg-purple-500/50 rounded-full p-3 w-12 h-12
grid place-items-center absolute bottom-0 right-0">
<FontAwesomeIcon icon={faCamera} className={"text-white/60 text-2xl"}/>
</div>
@Bishwas-py
Bishwas-py / django_deploy.md
Created May 20, 2022 00:35 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.