Skip to content

Instantly share code, notes, and snippets.

View ChrisMissal's full-sized avatar
💭
set status

Chris Missal ChrisMissal

💭
set status
View GitHub Profile
public class ConcurrentLeastFrequentlyUse<T> where T : class
{
private readonly int[] generationSizes;
private readonly ConcurrentQueue<T>[] queues;
public ConcurrentLeastFrequentlyUse(params int[] generationSizes)
{
this.generationSizes = generationSizes;
queues =new ConcurrentQueue<T>[generationSizes.Length];
}
@jonsagara
jonsagara / EmptyGuid.sql
Last active December 3, 2023 09:15
Generating Guid.Empty in SQL Server
--
-- 2021-11-24: suggestion from comments:
--
DECLARE @EmptyEmpty UNIQUEIDENTIFIER = CAST(0x0 AS UNIQUEIDENTIFIER)
SELECT @EmptyEmpty
--
-- Original
--
@BenHall
BenHall / cookies.js
Created January 19, 2012 17:06
How to get/set a cookie in Javascript
// Taken from: https://developer.mozilla.org/en/DOM/document.cookie
// docCookies.setItem("test1", "Hello world!");
// alert(docCookies.getItem("test1"));
docCookies = {
getItem: function (sKey) {
if (!sKey || !this.hasItem(sKey)) { return null; }
return unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"), "$1"));
},
setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
@ravasthi
ravasthi / _config.yml
Created February 15, 2012 08:59
Multiple authors on Jekyll
authors:
hanzou:
name: Hanzou Hattori
display_name: Hanzou
gravatar: c66919cb194f96c696c1da0c47354a6a
email: hanzou@company.com
web: http://company.com
twitter: company
github: hhattori
jorgen:
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@jstangroome
jstangroome / Deploy-SSRSProject.ps1
Created July 3, 2012 22:37
PowerShell scripts to deploy a SQL Server Reporting Services project (*.rptproj) to a Reporting Server
#requires -version 2.0
[CmdletBinding()]
param (
[parameter(Mandatory=$true)]
[ValidatePattern('\.rptproj$')]
[ValidateScript({ Test-Path -PathType Leaf -Path $_ })]
[string]
$Path,
[parameter(
@garann
garann / gist:3353532
Created August 14, 2012 22:23
Crowdsourced career mentorship for female developers

I was inspired by Selena Deckelmann's list of Career Resources for Women (http://www.chesnok.com/daily/career-resources-for-women/), but couldn't think of much to contribute. So I thought maybe those of us already in the field and in a position to mentor could work on creating more. Please fork or comment and add your own!

Also: there is a wealth of info online and elsewhere dating back to the first time it occurred to our species to exchange labor for currency on these topics in general. What I hope we can provide here is our take as individuals. What we would say to someone if we were sitting across from her acting as a mentor. I don't think we should worry about being objectively "right", or about duplicating topics. I add this bit of anti-editorializing in hopes that women will contribute without feeling pressured to be experts, which I worry might prevent them from doing so. TY. :)

Applying for jobs

@guerrerocarlos
guerrerocarlos / main.js
Created September 6, 2012 05:07
loading socket.io using require.js
// Require.js allows us to configure shortcut alias
require.config({
// The shim config allows us to configure dependencies for
// scripts that do not call define() to register a module
shim: {
'socketio': {
exports: 'io'
},
'underscore': {
exports: '_'
@leemeichin
leemeichin / README.md
Created October 9, 2012 16:11
Apply Standard Competition Rankings to your leaderboard

Standard Competition Rankings

This class makes it easier to generate a leaderboard that complies with the Standard Competition Ranking system. That is, it takes joint/tied positions into account, and adjusts the positions accordingly.

Take the following list of users and points for example:

User    | Points
1         35
2         35
public class DatabaseDeleter
{
private readonly ISessionFactory _configuration;
private static readonly string[] _ignoredTables = new[] { "sysdiagrams", "usd_AppliedDatabaseScript" };
private static string[] _tablesToDelete;
private static string _deleteSql;
private static object _lockObj = new object();
private static bool _initialized;
public DatabaseDeleter(ISessionFactory sessionSource)