Skip to content

Instantly share code, notes, and snippets.

Ryan Cole ryancole

Block or report user

Report or block ryancole

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View foo.ps1
# https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
while (1) {
$duration = Get-Random -Minimum 10 -Maximum 60
Write-Output "Waiting $duration seconds ...";
Start-Sleep -Seconds $duration
View fff.cpp
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#include "ShooterGame.h"
#include "Weapons/ShooterWeapon.h"
#include "Weapons/ShooterDamageType.h"
#include "UI/ShooterHUD.h"
#include "Online/ShooterPlayerState.h"
#include "Animation/AnimMontage.h"
#include "Animation/AnimInstance.h"
#include "Sound/SoundNodeLocalPlayer.h"
View foo.cs
var html = new HtmlDocument();
// load the document's html
html.LoadHtml(document.Html);
// create a string of the text only
document.Text = Regex.Replace(string.Join(" ", html.DocumentNode.SelectNodes("//text()").Select(m => m.InnerText)), @"\s+", " ").Trim();
View window.sql
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
View gist:b18ef1f0be5ab422872a
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
View handler.clj
(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"}]))
View regex.cs
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";
View foo.sql
-- 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?
View factorial.js
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') {
View fibonacci.js
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') {
You can’t perform that action at this time.