Skip to content

Instantly share code, notes, and snippets.

View orthros's full-sized avatar
☁️
Working from SSH

Colin Nelson orthros

☁️
Working from SSH
  • Seattle
View GitHub Profile
@orthros
orthros / isseEvent.json
Created June 28, 2017 01:23
GitHub Issue Event
{
"action": "created",
"issue": {
"url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/2",
"labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/2/labels{/name}",
"comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/2/comments",
"events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/2/events",
"html_url": "https://github.com/baxterthehacker/public-repo/issues/2",
"id": 73464126,
"number": 2,
@orthros
orthros / bountyfulUser.cs
Last active June 28, 2017 01:33
Class for a user bounty
public class BountyfulUser
{
public int Id { get; set; }
public string UserName { get; set; }
public int BountiesCompleted { get; set; }
}
public class DashboardController : Controller
{
UserBounty db = new UserBounty();
// GET: Dashboard
public ActionResult Index()
{
var topUsers = db.Users
.OrderByDescending(x => x.BountiesCompleted)
.Take(10);
@model IEnumerable<BountyCount.BountyfulUser>
@{
ViewBag.Title = "Dashboard";
}
<h2>Top Bounty Hunters!</h2>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.UserName)
</th>
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xs
begin tran
if exists (select * from dbo.BountyfulUsers with (updlock,serializable) where dbo.BountyfulUsers.UserName = '#[payload.userId]')
begin
update dbo.BountyfulUsers set BountiesCompleted += 1
where dbo.BountyfulUsers.UserName = '#[payload.userId]'
end
else
begin
insert into dbo.BountyfulUsers (UserName, BountiesCompleted)
values ('#[payload.userId]', 1)
{
"pull_request" : {
},
"action": "opened"
}
{
"pull_request":{
},
"action":"closed"
}
{
"expression": {
"issue": {
"%exists": true
}
},
"action": {
"%in": [
"opened"
]
{
"projection": {
"issue.html_url": 1,
"issue.id": 1,
"issue.title": 1,
"issue.comments": 1,
"issue.created_at": 1,
"repository.name": 1,
"repository.html_url": 1,
}