Skip to content

Instantly share code, notes, and snippets.

View bigeyex's full-sized avatar

Yu Wang bigeyex

  • ByteDance
  • Beijing, China
View GitHub Profile
@bigeyex
bigeyex / dispatcher.js
Created August 1, 2014 21:04
broadcast and receive global events in javascript
/*
Dispatcher module
by: wangyu (bigeyex@gmail.com)
dispatch global event
usage:
- fire an event:
dispatcher.dispatch('example.event.name', arg1, arg2...)
- subscribe an event:
dispatcher.subscribe('example.event.name', function(arg1, arg2...){});
def on_change_content():
return UpdateElement('detail_card', content=[
DetailGroup('Refund Request', content=[
DetailItem('Ordre No.', 1100000),
DetailItem('Status', "Fetched"),
DetailItem('Shipping No.', 1234567),
DetailItem('Sub Order', 1135456)
]),
])
@app.page('/', 'Dashboard')
def form_page():
return [
Row([
Column([
ChartCard('Total Sales', '$126,560', 'The total sales number of xxx', height=50,
content=[BarChart(visit_data, show_axis=False, height=50)],
footer=[Statistic('Daily Sales', '$12423', inline=True)])
]),
Column([
@bigeyex
bigeyex / adminui_menu_example.py
Created March 1, 2020 06:11
AdminUI menu example
app.set_menu(
[
MenuItem('home', '/', icon="dashboard"),
MenuItem('User Home', '/user_home', icon="dashboard", auth_needed='user', children=[
MenuItem('New Item', '/new', icon="plus"),
MenuItem('Search for Item', '/search', icon="search", auth_needed='admin'),
MenuItem('Admin', '/admin', icon="setting")
]),
MenuItem('Admin Only', '/', icon="dashboard", auth_needed='admin', children=[
MenuItem('New Item', '/new', icon="plus"),
@bigeyex
bigeyex / adminui_example_basic.py
Created March 1, 2020 05:37
A basic example of AdminUI
from adminui import *
app = AdminApp()
def on_submit(form_data):
print(form_data)
@app.page('/', 'form')
def form_page():
return [
@bigeyex
bigeyex / bolipolate.py
Last active February 22, 2020 07:04
jupyter notebook bolipolate
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rcParams['font.sans-serif']=['SimHei'] # for displaying Chinese characters correctly
plt.rcParams['axes.unicode_minus']=False # for displaying the minus sign correctly
df = pd.read_excel('E:\Work\path_to_excel_file.xlsx')
@bigeyex
bigeyex / bolipolate.ipynb
Created February 22, 2020 07:03
jupyter notebook bolipolate
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bigeyex
bigeyex / MBFlipImageView.h
Created January 7, 2016 10:32
"Extended UI Kit"
#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface MBFlipImageView : UIImageView
@property (nonatomic) IBInspectable UIImage *onImage;
@property (nonatomic) IBInspectable UIImage *offImage;
- (void)flipOn;
- (void)flipOff;
@bigeyex
bigeyex / gist:6400686
Created August 31, 2013 21:18
PHP Script Useful for making forms: according to POST contents, insert a record into db, create the table if not exist.
<?php
//settings
define('DB_NAME', ''); //db name
define('DB_USER', 'root');
define('DB_PWD', '');
define('TABLE_NAME', '');
define('IP_FIELD', 'ip'); // the field for visitor's ip address
@bigeyex
bigeyex / UIColor+HexString.h
Created December 18, 2015 12:40
UIClolor+HexString: Create your UIColor from a "css color code" style hex string
#import <Foundation/Foundation.h>
@interface UIColor (HexString)
+ (UIColor *) colorFromHexString:(NSString *)hexString;
@end