Skip to content

Instantly share code, notes, and snippets.

Yang Wei yang-wei

Block or report user

Report or block yang-wei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@yang-wei
yang-wei / fullscreen.css
Last active Nov 7, 2019
Full size background image using CSS cover in mobile devices
View fullscreen.css
html {
background: url(image url) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 100%;
overflow: hidden;
}
View install.sh
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@yang-wei
yang-wei / getUnix_ts.php
Created May 14, 2014
Get the FTW Unix TimeStamp of any format of time easily
View getUnix_ts.php
<?php
// use DateTime object to turn any format of date & time into standard form
//Example1
$date = DateTime::createFromFormat('m/d/y @ h:ia', '04/04/2014 @ 3.13pm')->getTimestamp();
//Example2
$date = DateTime::createFromFormat('YmdHis', '20130312000000')->getTimestamp();
View xml2json.php
<?php
header('Content-Type: application/json');
//$xmlfile = 'xml/EIT_00002_20140507.xml';
function xml2json($file) {
if (file_exists($file)) {
$xml = simplexml_load_file($file);
$date = $xml->EventDate;
@yang-wei
yang-wei / worldcup2014db.json
Last active Aug 29, 2015
World Cup 2014 Data
View worldcup2014db.json
[
{
"event": {
"key": "world.2014",
"title": "World Cup 2014"
},
"round": {
"pos": 1,
"title": "Matchday 1",
"start_at": "2014\/06\/12",
@yang-wei
yang-wei / vagrantLivereload
Created Aug 29, 2014
set grunt-este-watch livereload to work in host browser when using vagrant to host server
View vagrantLivereload
esteWatch:
options:
dirs: [
'<%= app_path %>/**/' # Set all directories here
]
livereload:
enabled: true
extensions: ['html', 'css', 'php', 'twig'] # File extensions to be watched
port: 8888 # set vagrant forwarded_port number, default is 35729
@yang-wei
yang-wei / jsbin.nadojahaheka.js
Last active Aug 29, 2015
Using lodash debounce in ng-repeat
View jsbin.nadojahaheka.js
(function(){
/* Todo: fix performance */
angular.module('app', [])
.controller('mainCtrl', function($scope){
$scope.countries = [
{ country: 'Japan', language: 'Japanese' },
{ country: 'Korea', language: 'Korean' },
{ country: 'North Korea', language: 'Korean'},
{ country: 'China', language: 'Chinese'},
{ country: 'Hong Kong', language: 'Cantonese'},
View index.html
<div class="container">
<div class="row">
<div class="col-xs-12">
<button class="btn btn-primary" onClick="render()">Render</button>
<button class="btn btn-danger" onClick="unmount()">Unmount</button>
</div>
<br/><br/>
<div class="col-xs-12" id="react"></div>
</div>
</div>
@yang-wei
yang-wei / app.js
Created Dec 2, 2014
React JS color slider
View app.js
(function(exports) {
'use strict';
var Slider = React.createClass({
getDefaultProps: function() {
return {
redVal: '',
greenVal: '',
blueVal: ''
You can’t perform that action at this time.