Skip to content

Instantly share code, notes, and snippets.

View yo1995's full-sized avatar
🤞
Everybody finds somebody someplace

Ting yo1995

🤞
Everybody finds somebody someplace
  • Redlands, CA
  • 13:47 (UTC -07:00)
View GitHub Profile
@yo1995
yo1995 / list.md
Last active March 30, 2023 23:40
All Apple Tutorials
@yo1995
yo1995 / downloadImages.js
Last active November 25, 2019 22:26
Download all images in a web page
// Image count
var imgTotal = 0;
var imgLoaded = 0;
// Get file name from a URL
function getFileName(o) {
var pos = o.lastIndexOf("/");
return o.substring(pos+1);
}
@yo1995
yo1995 / color.swift
Created October 18, 2019 03:15
Swift any string to HEX color string
import Foundation
func stringColorCode(_ s: String?) -> String {
guard let IDString = s else {
return "000000"
}
let hashInt = IDString.hashValue
let c = hashInt & 0xFFFFFF
let hexString = String(format:"%06x", c)
return hexString.suffix(6).uppercased()
@yo1995
yo1995 / LCGrand.cpp
Last active July 8, 2019 16:23
C++线性同余随机数生成
// Example program
#include <iostream>
#include <string>
inline int random1() {
static int seed = 703; // seed can be picked randomly
return seed = int(seed*48271LL%2147483647);
}
int main() {