Skip to content

Instantly share code, notes, and snippets.

View shengoo's full-sized avatar

shengoo

  • Beijing, China
View GitHub Profile
@shengoo
shengoo / npm set proxy
Created April 24, 2014 02:16
npm set proxy
$ npm config set proxy http://server:port
$ npm config set https-proxy http://server:port
$ npm config set proxy http://username:password@server:port
$ npm config set https-proxy http://username:pawword@server:port
输出HTML代码(包含标签):直接输出,
string html = "<font color='red'>文本</font>"; @html
输出HTML内容(不包含标签):有两种方法,
第一种:
IHtmlString html=new HtmlString("<font color='red'>文本</font>");@html ;
第二种:
string html = "<font color='red'>文本</font>"; @Html.Raw(html);
package
{
import mx.controls.Button;
public class ImageButton extends Button
{
[Embed(source="assets/image/button.png")]
private var icon:Class;
[Embed(source="assets/image/buttonon.png")]
private var overIcon:Class;
@shengoo
shengoo / gist:11239607
Created April 24, 2014 02:39
Check if Function Exists Before Calling
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}
@shengoo
shengoo / gist:11240171
Last active August 29, 2015 14:00
mxml fill background with color or image
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:HGroup width="100%" height="100%">
<s:Group width="50%" height="100%">
<s:Rect width="100%" height="100%"
@shengoo
shengoo / C# merge two list
Created April 24, 2014 03:14
C# merge two list
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<int> a = new List<int>();
a.Add(1);
a.Add(2);
@shengoo
shengoo / Customized ProgressBar in flex
Created April 24, 2014 03:22
Customized ProgressBar in flex
trackbar是整个的条
<?xml version=”1.0″ encoding=”utf-8″?>
<s:SparkSkin xmlns:fx=”http://ns.adobe.com/mxml/2009″ xmlns:s=”library://ns.adobe.com/flex/spark”
minHeight=”13″ >
<fx:Script>
override protected function initializationComplete():void
{
@shengoo
shengoo / Regex check email.html
Last active August 29, 2015 14:00
Regex check email
<html>
<head>
<script type="text/javascript" language="javascript">
function check() {
var email = document.getElementById("in").value;
if (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(email)){
document.getElementById("div1").innerHTML = "valid";
}else{
document.getElementById("div1").innerHTML = "invalid";
}
@shengoo
shengoo / Android unzip file using ZipInputStream
Last active February 27, 2017 08:33
Android unzip file using ZipInputStream
public class unzip extends Activity {
/** Called when the activity is first created. */
static final int BUFFER = 2048;
TextView textView;
@Override
public void onCreate(Bundle savedInstanceState) {
textView = new TextView(this);
@shengoo
shengoo / null and undefined in javascript
Last active August 29, 2015 14:00
null and undefined in javascript
> var un;
> console.log(un);
undefined
> var nu = null;
> console.log(nu);
null
> typeof un
'undefined'
> typeof nu
'object'