Skip to content

Instantly share code, notes, and snippets.

View johnw86's full-sized avatar

John Walker johnw86

View GitHub Profile
@davideicardi
davideicardi / uuidHelpers.js
Created November 16, 2017 15:52
Mongodb uuid helpers
// Javascript helper functions for parsing and displaying UUIDs in the MongoDB shell.
// This is a temporary solution until SERVER-3153 is implemented.
// To create BinData values corresponding to the various driver encodings use:
// var s = "{00112233-4455-6677-8899-aabbccddeeff}";
// var uuid = UUID(s); // new Standard encoding
// var juuid = JUUID(s); // JavaLegacy encoding
// var csuuid = CSUUID(s); // CSharpLegacy encoding
// var pyuuid = PYUUID(s); // PythonLegacy encoding
// To convert the various BinData values back to human readable UUIDs use:
// uuid.toUUID() => 'UUID("00112233-4455-6677-8899-aabbccddeeff")'
@zybroxz
zybroxz / NPM-Cheatsheet.txt
Last active July 28, 2017 20:34
NPM Cheatsheet
Update npm (needs running as administrator. ie sudo, or in windows run the shell as administrator)
npm i npm@latest -g
Install global package
npm i gulp -g
Install and save to dependencies in package.json
npm i lodash -S
Save to devDependencies
@a3dho3yn
a3dho3yn / mongodb_c#_cheatsheet.md
Last active March 10, 2025 21:41
MongoDB C# Driver Cheat Sheet

MongoDB C# Driver Cheat Sheet

(C) 2015 by Derek Hunziker, (C) 2017 by AppsOn

As of releasing MongoDB 3.4 and C# Driver v2.4, original cheatsheet by Derek is outdated. In addition, it has some deficiencies like connecting to MongoDB, creating indexes, etc. This updated version works fine with C# Driver v2.4.7 and MongoDB v3.4.

Setup

Define Document Models

Note: Defined models and collections will be used in entire cheatsheet.

@paulirish
paulirish / what-forces-layout.md
Last active March 15, 2025 16:10
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@DanDiplo
DanDiplo / JS-LINQ.js
Last active March 2, 2025 13:40
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
@abjerner
abjerner / Contour.md
Created December 3, 2014 18:29
Quick guide to insert Contour <script> tags at the bottom of the page rather than in context.

Open /umbraco/plugins/umbracoContour/views/Form.cshtml and look for the following line:

@Html.Partial(FormViewResolver.GetScriptView(Model.FormId), Model)

Replace it with these lines:

List temp = HttpContext.Current.Items["ContourScripts"] as List;
@mattbrailsford
mattbrailsford / PublishedContentExtensions.cs
Last active August 29, 2015 13:57
A JQuery like API for Umbraco
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.WebPages;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace Our.Umbraco.Api.Jq
{
public static class PublishedContentExtensions
@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) {