Skip to content

Instantly share code, notes, and snippets.

View trujunzhang's full-sized avatar

Trujun Zhang trujunzhang

View GitHub Profile
@h4n2k
h4n2k / .zshrc
Last active July 27, 2024 14:37
Multiple neovim
# Neovim Switcher
# https://gist.github.com/elijahmanor/b279553c0132bfad7eae23e34ceb593b
#
alias nvim-lazy="NVIM_APPNAME=LazyVim nvim"
alias nvim-kick="NVIM_APPNAME=kickstart nvim"
alias nvim-chad="NVIM_APPNAME=NvChad nvim"
alias nvim-astro="NVIM_APPNAME=AstroNvim nvim"
function nvims() {
items=("default" "kickstart" "LazyVim" "NvChad" "AstroNvim")
@jmatsushita
jmatsushita / README
Last active September 26, 2025 18:07
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
@nandorojo
nandorojo / react-native-file-upload.js
Created July 13, 2019 22:42
React Native Hook for uploading file (Cloudinary in this case)
import { useState } from 'react';
import CryptoJS from 'crypto-js';
// upload a file to cloudinary using React Hooks
// see below for what hooks are
// https://reactjs.org/docs/hooks-intro.html
// make sure you fill these out:
const API_KEY = '';
const SECRET = '';
@Mohamed3on
Mohamed3on / batchPrettier.md
Last active January 7, 2025 03:23
Run prettier on all JS files in a directory
  1. Install prettier
  2. Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
  3. Run prettier --write "**/*.js" *Don't forget the quotes.
  4. Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
@gregblass
gregblass / App.js
Last active September 21, 2019 17:30
Expo/React Navigation - Google Analytics Integration
import React, { Component } from 'react'
import { RootNavigator } from './navigators'
import { GoogleAnalyticsTracker } from './utils/analytics'
import { GA_TRACKING_ID } from './constants'
class App extends Component {
// gets the current screen from navigation state
getCurrentRouteName = (navigationState) => {
if (!navigationState) {
return null
@mustafaturan
mustafaturan / rename.sh
Created July 8, 2017 14:18
Rename all js files into jsx
for x in *.js; do mv "$x" "${x%.js}.jsx"; done
@ExReanimator
ExReanimator / imagemagick_problem.sh
Last active February 2, 2019 12:46
Can't install RMagick 2.16.0. Can't find MagickWand.h
$ brew tap homebrew/versions
$ brew install imagemagick@6
$ PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick
@scrapehero
scrapehero / geocoder.py
Created March 30, 2017 07:57
Python script to parse unstructured addresses
from requests import get
from pprint import pprint
from json import dump
from csv import QUOTE_ALL, DictWriter
API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
def address_resolver(json):
final = {}
if json['results']:
data = json['results'][0]
for item in data['address_components']:
@kocisov
kocisov / next_nginx.md
Last active February 3, 2025 07:27
How to setup next.js app on nginx with letsencrypt
@yogsototh
yogsototh / Tuto.md
Last active May 30, 2023 12:07
Starting Emacs in GUI with shell environment variables correctly set

Problem

When starting Emacs.app on Mac, the Emacs doesn't have some environment variable set correctly. Typically it is terrible when you use GPG, pinentry-mac, gpg-agent But also a lot of different variables used to make git works correctly, etc...

Solution

  1. Create the file ~/bin/init-app-env.sh: