Skip to content

Instantly share code, notes, and snippets.

@greglockwood
greglockwood / example.user.js
Last active December 18, 2023 01:48 — forked from jbryson3/example.user.js
This is an example showing Gist capability and how to auto update
// ==UserScript==
// @name EXAMPLE SCRIPT
// @version 0.9
// @description This is an example showing Gist capability and how to auto update
// @author jbryson3
// @match. https://www.google.com
// @grant none
// @updateURL https://gist.github.com/greglockwood/c39c9225a4b67f144703196f1959108a/raw/example.user.js
// @downloadURL https://gist.github.com/greglockwood/c39c9225a4b67f144703196f1959108a/raw/example.user.js
// ==/UserScript==
@greglockwood
greglockwood / input.scss
Created December 9, 2021 02:10
Generated by SassMeister.com.
@function -strip-unit($num) {
@return $num / ($num * 0 + 1);
}
@function -convert-to-rem($value, $base-value) {
$value: -strip-unit($value) / -strip-unit($base-value) * 1rem;
@if ($value == 0rem) { $value: 0; } // Turn 0rem into 0
@return $value;
}
@greglockwood
greglockwood / foo.json
Created March 23, 2020 22:29
Test JSON
[
{
"foo": "abc",
"bar": 0
},
{
"foo": "xyz",
"bar": 1
}
]
@greglockwood
greglockwood / no-extra-properties.ts
Last active August 6, 2023 21:18
NoExtraProperties<T> TypeScript type
/*********************************************************************************
Copyright (c) 2019, Greg Lockwood
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
@greglockwood
greglockwood / .gitignore
Last active July 19, 2019 17:25
NoExtraProperties<T> generic type in TypeScript
node_modules
**/*.js
@greglockwood
greglockwood / debug-helpers.js
Created April 18, 2017 22:56
Debug Helper Functions Snippet
const print = (param, ...args) => {
console.log(param, ...args);
return param;
};
const traceFn = (fn, context) => function () {
console.trace(`${fn.name} called with arguments: `, arguments);
return fn.apply(context || this, arguments);
};
@greglockwood
greglockwood / angular-grid.ts
Created June 15, 2015 08:41
Angular Grid Typescript Definitions
declare module ng.grid {
interface GridOptions<T> {
columnDefs?: ColumnDef<T>[]; // Array of Column Definitions..
groupHeaders?: boolean; // Whether to group the headers. Default is false.
headerHeight?: number; // Height, in pixels, of the header row. If not grouping headers, default is 25. If grouping headers, default is 50.
rowData?: T[]; // Data to be displayed as rows in the table
rowSelection?: string; // Type of row selection, set to either 'single' or 'multiple' to enable selection.
rowDeselection?: boolean; // Set to true or false (default is false). If true, then rows will be deselected if you hold down ctrl + click the row.
pinnedColumnCount?: number; // Number of columns to pin. Default is 0.
@greglockwood
greglockwood / dabblet.css
Created July 30, 2013 12:09
Quote demonstration
/**
* Quote demonstration
*/
html {
min-height: 100%;
}
body {
background-image: linear-gradient(yellow, orange);
@greglockwood
greglockwood / dabblet.css
Created July 12, 2013 04:49
Use the following CSS code if you want to use data attributes for inserting your icons
@font-face {
font-family: 'IcoMoon';
src: url('http://benfrain.com/downloads/IcoMoon.eot');
src: url('http://benfrain.com/downloads/IcoMoon.eot?#iefix') format('embedded-opentype'),
url('http://benfrain.com/downloads/IcoMoon.svg#IcoMoon') format('svg'),
url('http://benfrain.com/downloads/IcoMoon.woff') format('woff'),
url('http://benfrain.com/downloads/IcoMoon.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}