Skip to content

Instantly share code, notes, and snippets.

View ste2425's full-sized avatar

Stephen Cooper ste2425

View GitHub Profile
@ste2425
ste2425 / tileMapOffset.js
Created June 23, 2021 09:19
Offset TileMap for fonts used in GBDK-2020
/*
font tiles in GBDK are always inserted at the start.
This script will offset existing tile maps by the number of
tiles in the font.
*/
const fontTileSize = 37;
const tileMap = [/* Tile map array of hex values */];
@ste2425
ste2425 / penisExtension.ps1
Created November 28, 2018 13:59
Penis Extension.
<#
Will install a VSCode extension.
https://github.com/hoovercj/vscode-power-mode
Sets a custom image.
Best to put this on a share then execute on anyones machine that they leave unlocked.
**NOTE**
It will merge with their existing settings.json. May want to take a backup first.
@ste2425
ste2425 / enumerator.js
Last active August 1, 2018 07:34
Close Contacts Enumerator polly-fill
if (!window.Enumerator) {
window.Enumerator = function (c) {
this._c = Array.from(c);
this._index = 0;
}
window.Enumerator.prototype.atEnd = function () {
return this._index >= this._c.length - 1;
}
@ste2425
ste2425 / .gitignore
Created July 23, 2017 17:46 — forked from iffy/.gitignore
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@ste2425
ste2425 / store.js
Last active May 12, 2017 14:27
Electron persistent store
'use stirct';
const electron = require('electron'),
userDataPath = (electron.app || electron.remote.app).getPath('userData'),
path = require('path'),
fs = require('fs');
class Store {
constructor(configName = '') {
// Probably want to implement error handling
@ste2425
ste2425 / disableValidation.js
Created December 2, 2016 14:06
Prevent validation on disabled and hidden elements
.directive('ignoreDisabled', ['$exceptionHandler', ($exceptionHandler) => {
return {
restrict: 'A',
require: 'ngModel',
link: ($scope, elem, attr, ctrl) => {
if (!attr.hasOwnProperty('ngDisabled')) {
$exceptionHandler(new ReferenceError('Attempt to use ignoreDisabled on element without ngDisabled.'));
} else {
$scope.$watch(attr.ngDisabled, (val, oldVal) => {
if (val === true && val !== oldVal) {
@ste2425
ste2425 / promisifyExample.js
Created November 2, 2016 16:08
Little promisify helper
let promisify = (fn) => (...args) =>
new Promise((rCB, eCB) =>
fn(...args, (e, r) => {
if (e)
eCB(e);
else
rCB(r);
}));
promisify(sass.render({
@ste2425
ste2425 / vendorPrefix.scss
Created July 21, 2016 09:03
Vender prefix utility
@mixin vendorPrefix($prop, $val) {
-webkit-#{$prop}: $val;
-moz-#{$prop}: $val;
-ms-#{$prop}: $val;
-o-#{$prop}: $val;
#{$prop}: $val;
}
/*
Use:
@ste2425
ste2425 / _grid.scss
Created July 20, 2016 14:35
response grid layout
/*
Variables:
$screen-size-small
$screen-size-medium
$screen-size-large
$grid-small-screen-width
$grid-medium-screen-width
$grid-large-screen-width
@ste2425
ste2425 / group.js
Created July 15, 2016 15:18
Simple JavaScript Group
"use strict";
let group = (arr, by) => arr.reduce((prev, cur) => {
let val = isFunction(by) ? by(cur) : cur[by];
prev.hasOwnProperty(val) ? prev[val].push(cur) : prev[val] = [cur];
return prev;
}, {}),
isFunction = (x) => Object.prototype.toString.call(x) === "[object Function]";
module.exports = () => ({group, isFunction});