Skip to content

Instantly share code, notes, and snippets.

@mz121star
mz121star / gist:868c544956f61f0126da
Created January 4, 2015 13:29
fragment和Activity之间互调
如何在一个fragment or 任意类中操作另一个fragment中的方法
1 如何在acitivty中执行fragment中的方法:
首先获得这个Fragment的对象
xxxFragment fragmentObject = (xxxFragment) getFragmentManager.findFragmentByTag("xx");
2 如何在Fragment中执行activity中的方法:
第一种:让acitivity继承接口
第二种:在fragment中使用getActivity()但是要加上acitivity的名字,即:
((MainActivity)getActivity()).xxx();
增加模块guaguahuandeng
add:tpl/User/default ->guaguahuandeng.html
add:tpl/User/default ->guaguahuandeng_add.html
add:PigCms/Lib/Action/User ->guaguahuandengAction.class.php
add:PigCms\Lib\Model\User ->guaguahuandengModel.class.php 增加字段验证
edit: tpl\User\default\Public_head.html ::286line 修改导航栏菜单
edit: PigCms\Lib\Action\BaseAction.class.php ::85line 修改回复keyword
@mz121star
mz121star / udpserver.js
Created February 11, 2014 15:07
nodejs udp server
var PORT = 33333;
var HOST = '127.0.0.1';
var dgram = require('dgram'); // UDP需要引入该模块
var server = dgram.createSocket('udp4'); // ipv4
// 给server绑定'listening'事件处理函数
server.on('listening', function () {
var address = server.address();
console.log('UDP Server listening on ' + address.address + ":" + address.port);
@mz121star
mz121star / iterator.js
Created January 22, 2014 12:39
Iterator
var Iterator=function(rang){
if( !(this instanceof Iterator)) {
return new Iterator(rang);
}
this.rang=rang;
}
Iterator.prototype.next=function(){
return this.rang.pop();
function start(){$.ajax({
type:"GET"
,url:"http://vote.runsky.com/2013/10/runsky_palicai/?app=index&act=vote&value=603&_=1384221567745"
,headers:{"X-Forwarded-For":"210.83.216.36"}
}).success(function(d){console.log(d)})}
setInterval(start,100)
var http = require('http')
var HTTPPost = function (host, path, port, data, callback) {
var result = "";
http.globalAgent.maxSockets = Infinity
var options = {
hostname:"vote.runsky.com",
@mz121star
mz121star / EF CodeFirst
Last active December 19, 2015 08:19
EF CodeFirst
Database.SetInitializer(new DropCreateDatabaseAlways<MusicStoreDB>());
public class MusicStoreDbInitializer: DropCreateDatabaseAlways<MusicStoreDB>
{
protected override void Seed(MusicStoreDB context)
{
context.Artists.Add(new Artist {Name = "Al Di Meola"});
context.Genres.Add(new Genre { Name = "Jazz" });
context.Albums.Add(new Album
[
{
"spec name": "CSS Animations",
"uri": "http://www.w3.org/TR/css3-animations",
"category": "css-property",
"Name": "animation-name",
"Value": "<single-animation-name> [\n ‘,’ <single-animation-name> ]*",
"Initial": "‘none’",
"Applies To": "all elements, ::before and ::after pseudo-elements",
"Inherited": "no",
@mz121star
mz121star / Form1.cs
Created March 27, 2013 16:03
webapp的winform宿主程序
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace SignalRSample
{
public class RouteConfig