Skip to content

Instantly share code, notes, and snippets.

View lvjian700's full-sized avatar

Jian Lyu lvjian700

View GitHub Profile
@lvjian700
lvjian700 / BinaryTreeBuidler.kt
Created March 4, 2024 01:59
A kotlin DSL for building Binary Tree
data class TreeNode(
var `val`: Int,
var left: TreeNode? = null,
var right: TreeNode? = null
)
fun binaryTree(value: Int, init: TreeNode.() -> Unit) = TreeNode(value).apply(init)
fun TreeNode.left(value: Int, init: TreeNode.() -> Unit = {}) {
left = TreeNode(value).apply(init)
@lvjian700
lvjian700 / MessageLoadingView.swift
Created February 25, 2024 10:34
Showing iMessage like loading 3 dots animation.
import SwiftUI
struct MessageLoadingView: View {
@State private var animate = false
var body: some View {
HStack(spacing: 5) {
ForEach(0..<3, id: \.self) { index in
Circle()
.frame(width: 8, height: 8)
@lvjian700
lvjian700 / download_abc_kids_story.md
Last active October 22, 2021 12:05
A script to download audio from abc kids listen website
@lvjian700
lvjian700 / header.sh
Created January 25, 2021 04:18
Debugging shellscript
#!/usr/bin/env bash
# Enable xtrace if the DEBUG env variable is set
if [[ ${DEBUG-} =~ ^1|yes|true$ ]]; then
set -o xtrace # Trace the exec of the script(debug)
fi
# A better class of script...
set -o errexit # Exist on most errors
set -o errtrace # Make sure any error trap is inherited
{
"firstName": "Jian",
"lastName": "Lv"
}
@lvjian700
lvjian700 / chinese profile.md
Created July 24, 2014 06:38
Personal Profile

#吕健软件开发工程师简历

2008年本科毕业,从2009年4月开始,在北京中科大洋科技发展股份有限公司工作至今。
现职位: 软件开发工程师

##基本信息

姓名: 吕健
性别: 男
出生日期: 1986年10月

@lvjian700
lvjian700 / install_ffmpeg_macos.sh
Created December 5, 2013 02:03
Install ffmpeg using homebrew
brew install ffmpeg \
--with-fdk-aac \
--with-ffplay \
--with-freetype \
--with-frei0r \
--with-libass \
--with-libvo-aacenc \
--with-libvorbis \
--with-libvpx \
--with-opencore-amr \
@lvjian700
lvjian700 / remove_CLI.sh
Created August 17, 2013 06:56
remove xcode command line tools
RECEIPT_FILE=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom
RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
if [ ! -f "$RECEIPT_FILE" ]
then
echo "Command Line Tools not installed."
exit 1
fi
echo "Command Line Tools installed, removing ..."
@lvjian700
lvjian700 / DYDB.h
Created July 30, 2013 14:46
FMDB 基本使用
#import <Foundation/Foundation.h>
#import <FMDB/FMDatabase.h>
@interface DYDB : NSObject {
}
@property(nonatomic, readonly) FMDatabase *database;
+ (DYDB *) sharedDB;
@lvjian700
lvjian700 / LangUtils.h
Created June 28, 2013 03:20
LangUtils for Objective C, include: frame2String, int/long2String, RGBA #define ....
#import <Foundation/Foundation.h>
#define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
@interface LangUtils : NSObject
+ (NSString *) int2String: (int) number;
+ (NSString *) long2String: (long) number;