Skip to content

Instantly share code, notes, and snippets.

View dipeshdulal's full-sized avatar
💭
🙏 नमस्कार

Dipesh Dulal dipeshdulal

💭
🙏 नमस्कार
View GitHub Profile
@larryonward
larryonward / gist:5c845651b9a9a64875864b7ddcfc7323
Created December 4, 2024 03:12
hotfix for drizzle-orm 0.37.0, drizzle-kit 0.29.0
# TypeError: Cannot destructure property 'resourceArn' of 'connection' as it is undefined.
# fix: use other way to check if instance is RDSDataClient
sed -i '' 's/params\[0\] instanceof RDSDataClient/params\[0\].constructor.name === "RDSDataClient"/g' node_modules/drizzle-orm/aws-data-api/pg/driver.js
# Error: The result contains the unsupported data type "CHAR".
# fix: cast CHAR to TEXT
sed -i '' 's/const proxy = async (params) => {/const proxy = async (params) => {\n params.sql = params.sql.replace(\/a.attidentity AS identity_type\/i, '\''a.attidentity::text AS identity_type'\''); \n params.sql = params.sql.replace(\/a.attgenerated AS generated_type\/i, '\''a.attgenerated::text AS generated_type'\'');/g' node_modules/drizzle-kit/bin.cjs
sed -i '' 's/const proxy = async (params) => {/const proxy = async (params) => {\n params.sql = params.sql.replace(\/con.contype AS constraint_type\/i, '\''con.contype::text AS constraint_type'\'');/g' node_modules/drizzle-kit/bin.cjs
# ERROR: bind
@ozcanzaferayan
ozcanzaferayan / App.tsx
Last active October 25, 2022 16:18
React Native WebRTC localStream example
import React, {useState} from 'react';
import {SafeAreaView, StyleSheet, View, Button} from 'react-native';
import {
RTCView,
mediaDevices,
MediaStream,
MediaStreamConstraints,
} from 'react-native-webrtc';
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 9, 2025 18:06
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@gofer
gofer / tz-change
Created September 28, 2016 09:08
Change TimeZone to Tokyo on Linux
#!/bin/sh
# LinuxのTimeZoneを変更
# 参考
# http://qiita.com/azusanakano/items/b39bd22504313884a7c3
# タイムゾーンの変更
cp /etc/localtime /etc/localtime.original
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
@markerikson
markerikson / nodeenvDiscussion.md
Last active January 9, 2023 15:24
Summary of process.env.NODE_ENV and its use with Webpack

[02:06 PM] acemarke: @Steven : a couple other thoughts on the whole NODE_ENV thing. First, per my comments, it really is a Node concept. It's a system environment variable that Node exposes to your application, and apparently the Express web server library popularized using its value to determine whether to do optimizations or not
[02:08 PM] acemarke: Second, because of its use within the Node ecosystem, web-focused libraries also started using it to determine whether to they were being run in a "development" environment vs a "production" environment, with corresponding optimizations. For example, React uses that as the equivalent of a C #ifdef to act as conditional checking for debug logging and perf tracking. If process.env.NODE_ENV is set to "production", all those if clauses will evaluate to false.
Third, in conjunction with a tool like UglifyJS that does minification and removal of dead code blocks, a clause that is surrounded with if(process.env.NODE_ENV !== "development")

@mdwhatcott
mdwhatcott / custom_json.go
Created July 29, 2015 17:15
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground: http://play.golang.org/p/7nk5ZEbVLw
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
)
func main() {
@nixta
nixta / .htaccess
Last active December 28, 2024 20:15
.htaccess to add CORS to your website
# Add these three lines to CORSify your server for everyone.
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"