Skip to content

Instantly share code, notes, and snippets.

@metavige
metavige / gist:6471
Created August 21, 2008 00:41
Java: Helloworld Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!!!");
}
}
@metavige
metavige / sublimetext2.html
Created May 10, 2012 19:26 — forked from lucifr/sublimetext2.html
Sublime Text 2 Shortcuts for Cheaters
<table>
<caption>打开/前往</caption>
<colgroup>
<col style="text-align:left;width:150px"/>
<col style="text-align:left;"/>
</colgroup>
<thead>
<tr>
<th scope="col">快捷键</th>
<th scope="col">说明</th>
@metavige
metavige / 0_reuse_code.js
Created October 4, 2013 08:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@metavige
metavige / topshelf-start
Created October 4, 2013 08:57
TopShelf Startup
// Start setup running service
HostFactory.New(x =>
{
x.Service<DeployMonitorService>(c =>
{
c.ConstructUsing(s => ServiceLocator.Current.GetInstance<DeployMonitorService>());
c.WhenStarted(s => s.Start());
c.WhenStopped(s => s.Stop());
c.WhenPaused(s => s.Pause());
c.WhenContinued(s => s.Resume());
@metavige
metavige / JobFactory.cs
Created October 4, 2013 09:01
Quartz.Net + Ninject
using System; using Microsoft.Practices.ServiceLocation; using Quartz; using Quartz.Spi; namespace Nebula.JobAgent.Common { public class JobFactory : IJobFactory { public Quartz.IJob NewJob(TriggerFiredBundle bundle, Quartz.IScheduler scheduler) { try { var jobDetail = bundle.JobDetail; var jobType = jobDetail.JobType; return (IJob)ServiceLocator.Current.GetInstance(jobType); } catch (Exception e) { var se = new SchedulerException("Problem instantiating class", e); throw se; } } public void ReturnJob(IJob job) { // TODO??? } } }
@metavige
metavige / gist:7542576
Created November 19, 2013 09:20
getlocalip
public static string localIPAddress()
{
IPHostEntry host;
string localIP = "";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
localIP = ip.ToString();
String[] temp = localIP.Split('.');
@metavige
metavige / Gruntfile.js
Created January 3, 2014 14:08
Gruntfile with proxy
'use strict';
var lrSnippet = require('connect-livereload')();
var mountFolder = function(connect, dir) {
return connect.static(require('path').resolve(dir));
};
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
module.exports = function(grunt) {
@metavige
metavige / controller sample
Created January 8, 2014 08:13
controller sample
define([''], function () {
'use strict';
return {
initialize: function () {
// initialize function!
},
/**
* 初始化要顯示在操作區的 View, Home 首頁
*/
@metavige
metavige / hosts.ps1
Last active May 6, 2020 23:43 — forked from markembling/hosts.ps1
hosts.ps1
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
/// <summary>
/// [Postman](http://getpostman.com) collection representation
/// </summary>
public class PostmanCollectionGet
{
/// <summary>
/// Id of collection
/// </summary>
[JsonProperty(PropertyName = "id")]
public Guid Id { get; set; }