Skip to content

Instantly share code, notes, and snippets.

@yang-wei
yang-wei / scopes.txt
Last active January 4, 2016 14:09 — forked from iambibhas/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 February 6, 2023 23:50
Full size background image using CSS cover in mobile devices
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;
}
#!/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 14:26
Get the FTW Unix TimeStamp of any format of time easily
<?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();
<?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 August 29, 2015 14:02
World Cup 2014 Data
[
{
"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 August 29, 2014 17:10
set grunt-este-watch livereload to work in host browser when using vagrant to host server
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 August 29, 2015 14:06
Using lodash debounce in ng-repeat
(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'},
<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 December 2, 2014 03:47
React JS color slider
(function(exports) {
'use strict';
var Slider = React.createClass({
getDefaultProps: function() {
return {
redVal: '',
greenVal: '',
blueVal: ''