Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Content Include="App.config">
<SubType>Designer</SubType>
</Content>
<Content Include="App.Base.config">
<DependentUpon>App.config</DependentUpon>
</Content>
<Content Include="App.Debug.config">
@ryancole
ryancole / codecombat.js
Created June 19, 2014 20:19
gold rush mode human
// get all items in this frame split into regions
function getRegionItems (items) {
var result = [];
items.forEach(function (item) {
var x = Math.floor(item.pos.x / 28);
var y = Math.floor(item.pos.y / 28);
var region = (x * 4) + y;
if (result[region] === undefined) {
result[region] = [item];
@ryancole
ryancole / foo.js
Created September 25, 2014 03:12
array-based stack and queue, without using built in push pop
function stack () {
var content = [];
return {
push: function (v) {
content[content.length] = v;
},
pop: function () {
var result = content.splice(-1, 1);
if (result.length === 1) {
@ryancole
ryancole / fibonacci.js
Created September 25, 2014 03:29
fibonacci
function fibonacci (n) {
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
};
var fibonacci_memo = (function () {
var memo = [0,1];
function fib (n) {
var result = memo[n];
if (typeof result !== 'number') {
@ryancole
ryancole / factorial.js
Created September 25, 2014 03:36
factorial
function factorial (n) {
return n <= 1 ? 1 : n * factorial(n - 1);
};
var factorial_memo = (function () {
var memo = [1];
function fac (n) {
var result = memo[n];
if (typeof result !== 'number') {
-- original query without the aggregation
SELECT o.OpinionDocumentId,
o.DisplayTitle,
o.Date
FROM dbo.OpinionDocumentOpinionDocuments c
JOIN dbo.OpinionDocuments o ON o.OpinionDocumentId = c.OpinionDocument_OpinionDocumentId
WHERE c.OpinionDocument_OpinionDocumentId1 = 617143
-- adjusted query with aggregation sub-query
-- can this query be improved?
@ryancole
ryancole / regex.cs
Created March 10, 2015 22:27
RegExWoo
using System;
using System.Text.RegularExpressions;
namespace RegExWoo
{
class Program
{
static void Main(string[] args)
{
var text = "701 N.Y.S.2d 766, 123 N.Y.S.2d 256 (N.Y.City Civ.Ct. 1999), McEntee v Cappucci";
(ns replays.handler
(:require [compojure.core :refer [GET defroutes]]
[compojure.route :as route]
[ring.util.response :refer [response resource-response]]
[ring.middleware.json :as json]
[ring.middleware.defaults :refer [wrap-defaults api-defaults]]))
(defroutes app-routes
(GET "/" [] (resource-response "index.html" {:root "public"}))
(GET "/widgets" [] (response [{:name "Widget 1"} {:name "Widget 2"}]))
host=prod.na2.lol.riotgames.com
xmpp_server_url=chat.na2.lol.riotgames.com
ladderURL=http://www.leagueoflegends.com/ladders
storyPageURL=http://www.leagueoflegends.com/story
lq_uri=https://lq.na2.lol.riotgames.com
ekg_uri=https://ekg.riotgames.com
regionTag=na
rssStatusURLs=null
lobbyLandingURL=http://landing.leagueoflegends.co.kr/
loadModuleChampionDetail=true
WITH RankedMonthlySizes AS
(
SELECT Matter_MatterId AS MatterId,
HostingFilesize,
DENSE_RANK() OVER (PARTITION BY Matter_MatterId ORDER BY MonthAndYear DESC) AS DateRank
FROM dbo.RelativityMatterFilesizes
)
SELECT s.MatterId, s.HostingFilesize
FROM RankedMonthlySizes AS s
JOIN dbo.Matters AS m ON m.MatterId = s.MatterId