Skip to content

Instantly share code, notes, and snippets.

View no13bus's full-sized avatar
🎯
Focusing

DanielJia no13bus

🎯
Focusing
View GitHub Profile
@no13bus
no13bus / CameraView.swift
Last active October 23, 2023 12:57
ContentView.swift
import SwiftUI
import AVKit
struct CameraView: UIViewRepresentable {
var frameSize: CGSize
@Binding var session: AVCaptureSession
func makeUIView(context: Context) -> UIView {
let view = UIViewType(frame: CGRect(origin: .zero, size: frameSize))
view.backgroundColor = .clear
let cameraLayer = AVCaptureVideoPreviewLayer(session: session)
@no13bus
no13bus / ZoomDragView.swift
Created October 17, 2023 13:27
zoomanddrag
import SwiftUI
struct Line {
var points: [CGPoint]
}
struct ZoomDragView: View {
@State private var scale = 1.0
@State private var lastScale = 1.0
//
// ContentView.swift
// Example-iOS
//
// Created by Alex.M on 26.05.2022.
//
import SwiftUI
class Visible: ObservableObject {
@no13bus
no13bus / ContentView.swift
Created September 22, 2023 12:02
ContentView
//
// ContentView.swift
// Example-iOS
//
// Created by Alex.M on 26.05.2022.
//
import SwiftUI
@no13bus
no13bus / boilerplatesimpledjangoninja.sh
Created August 26, 2023 16:01 — forked from liviocunha/boilerplatesimpledjangoninja.sh
Boilerplate Simple Django Ninja
# V 0.0.3
# 2021-05-05
# Shell script to create a very simple Django Ninja project.
# This script require Python 3.x and pyenv
# Settings.py is config to Django 3.1.5 and Django Ninja 0.12.1
# The project contains:
# Settings config
# Admin config
@no13bus
no13bus / StreamTest.java
Last active December 20, 2022 12:14
check a json list is sorted or not
package com.usersapi;
import com.alibaba.fastjson.JSONArray;
import java.io.InputStream;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@no13bus
no13bus / index.html
Last active September 16, 2015 14:22
Simples MVVM Example with Javascript
<!--
English:
This example show how do a simple MVVM code with html+js
You can change the data in design and the object person will be changed, you can too make the change by the console(js) of the property from the object and the visual will be changed.
Portugues:
Esse exemplo mostra como fazer um simples MVVM framework com HTML e JS
Você pode alterar os dados visualmente e o objeto pessoa vai ser alterado e também se você fizer a alteração via console da propriedade o visual será modificado.
-->
<!DOCTYPE html>
<html>
@no13bus
no13bus / toutiao.py
Last active August 29, 2015 14:27
toutiao api
import requests
import datetime
from bs4 import BeautifulSoup
def get_posts_by_day(date_str)
url='http://toutiao.io/prev/%s' % date_str
r=requests.get(url)
c=r.content
soup = BeautifulSoup(c)
posts=soup.find_all('div', 'post')
class models_a(models.Model):
value_a = models.FloatField(default=0.0)
value_a_1 = models.FloatField(default=0.0)
class models_b(models.Model):
foreign = models.ForeignKey(models_a)
value_b = models.FloatField(default=0.0)
####进行更新model_b里面的字段value_b,让他的值等于models_a里面的value_a和value_a_1和value_b这三个值之和
results = models_b.objects.exclude(value_b=0.0)
@no13bus
no13bus / proxies
Last active August 29, 2015 14:07
import requesocks as requests
session = requests.session()
session.proxies = {'http': 'socks5://127.0.0.1:7070','https': 'socks5://127.0.0.1:7070'}
s=session.get('https://www.facebook.com')
print s