Skip to content

Instantly share code, notes, and snippets.

View damozhang's full-sized avatar
🏠
Working from home

Wei damozhang

🏠
Working from home
  • California
View GitHub Profile
@damozhang
damozhang / Extension+Color.swift
Last active March 9, 2022 05:58
tailwindcss colors in SwiftUI
extension Color{
static let tailwind = Color.Tailwind()
struct Tailwind{
let bgSlate50 = Color(red:248/255,green:250/255,blue:252/255)
let bgSlate100 = Color(red:241/255,green:245/255,blue:249/255)
let bgSlate200 = Color(red:226/255,green:232/255,blue:240/255)
let bgSlate300 = Color(red:203/255,green:213/255,blue:225/255)
apt upgrade -y
apt update -y
apt install nginx -y
apt install php7.2-fpm php7.2-gd php7.2-gmp php7.2-mysql php7.2-pgsql php7.2-bcmath php7.2-curl php7.2-dom php7.2-mbstring php7.2-bz2 php7.2-zip php-redis libmcrypt-dev php-pear php-dev -y
pecl channel-update pecl.php.net
pecl install mcrypt-1.0.2
touch /etc/php/7.2/fpm/conf.d/20-mcrypt.ini
echo 'extension=mcrypt.so'> /etc/php/7.2/fpm/conf.d/20-mcrypt.ini
[{
"CMYK": [4, 5, 18, 0],
"RGB": [249, 244, 220],
"hex": "#f9f4dc",
"name": "\u4e73\u767d",
"pinyin": "rubai"
}, {
"CMYK": [3, 8, 30, 0],
"RGB": [249, 236, 195],
"hex": "#f7e8aa",
[
{
"code": "AF",
"ln": "‫افغانستان‬‎",
"name": "Afghanistan",
"tel": "93"
},
{
"code": "AL",
"ln": "Shqipëri",
let stateDictionary: [String : String] = [
"AK" : "Alaska",
"AL" : "Alabama",
"AR" : "Arkansas",
"AS" : "American Samoa",
"AZ" : "Arizona",
"CA" : "California",
"CO" : "Colorado",
"CT" : "Connecticut",
@damozhang
damozhang / Cachable.swift
Created July 11, 2018 21:30
A protocol to manage cache.
import Foundation
import Disk
public protocol Cachable: Codable{
associatedtype CacheObject
var cacheName: String {get}
static func cacheId(_ id: String?) -> String
static func loadCache(cacheName: String) -> CacheObject?
#! /bin/sh
#
# Downloaded from:
# http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/supervisor/trusty/view/head:/debian/supervisor.init
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian
@damozhang
damozhang / torndb.ex.py
Created January 28, 2015 20:06
Examples of that how to use Torndb.
import torndb
mysql_settings = {
'host': 'localhost:3306',
'user': 'user',
'password': 'password',
'database': 'database',
'time_zone': '-8:00',
'charset': 'utf8'
@damozhang
damozhang / NSDictionary+QueryStringBuilder.h
Created May 28, 2012 02:48 — forked from ehabkost/NSDictionary+QueryStringBuilder.h
Creating a query string from an NSDictionary.
#import <Foundation/Foundation.h>
@interface NSDictionary (QueryStringBuilder)
- (NSString *)queryString;
@end