Skip to content

Instantly share code, notes, and snippets.

View getaclue00's full-sized avatar

Alex getaclue00

View GitHub Profile
@getaclue00
getaclue00 / window.electron.sample.js
Created November 11, 2018 14:39
window electron sample notion
function createWindow(urlPath) {
if (urlPath === void 0) { urlPath = ""; }
var windowState = windowStateKeeper({
defaultWidth: 1320,
defaultHeight: 860,
});
var rect = {
x: windowState.x,
y: windowState.y,
width: windowState.width,
@getaclue00
getaclue00 / mozGetMatchedCSSRules.js
Created October 9, 2018 15:47 — forked from darrnshn/mozGetMatchedCSSRules.js
A Blink only polyfill for Webkit's window.getMatchedCSSRules
// polyfill window.getMatchedCSSRules() in Chrome
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
@getaclue00
getaclue00 / random.js
Created October 3, 2018 17:02
Reverse Polish notation
var input = `15 7 1 1 + − ÷ 3 × 2 1 1 + + −`
var processed_input = input.split(' ')
function RPN() {
var stack = [];
var f = function() {
};
f.size = function() {
return stack.length;
}

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@getaclue00
getaclue00 / NSWorkspace+ApplicationForOpeningURL.h
Created August 19, 2018 16:37 — forked from scottjacksonx/NSWorkspace+ApplicationForOpeningURL.h
Checking whether your Mac has an app to open a URL
//
// NSWorkspace+ApplicationForOpeningURL.h
//
// Created by Scott Jackson on 10/07/12.
// Copyright (c) 2012 SJSoftware. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSWorkspace (ApplicationForOpeningURL)
@getaclue00
getaclue00 / AutoGrowingTextField.swift
Created August 13, 2018 22:24 — forked from takuoka/AutoGrowingTextField.swift
Example of an NSTextField that expands its height automatically. https://github.com/DouglasHeriot/AutoGrowingNSTextField
import Cocoa
// https://github.com/DouglasHeriot/AutoGrowingNSTextField
// for AutoLayout
class AutoGrowingTextField: NSTextField {
var minHeight: CGFloat? = 100
@getaclue00
getaclue00 / NSShadow Example
Created August 10, 2018 16:32 — forked from peerasak-u/NSShadow Example
NSShadow Example
NSShadow *textShadow = [[NSShadow alloc] init];
textShadow.shadowColor = [UIColor darkGrayColor];
textShadow.shadowBlurRadius = 1.2;
textShadow.shadowOffset = CGSizeMake(1,1);
NSDictionary *attributes = @{NSForegroundColorAttributeName: [UIColor blackColor],
NSShadowAttributeName: textShadow
};
/*
* StickyNoteView
*
* Created by Jim McGowan on 04/10/2007.
* Updated 05/09/2012 for Reference Tracker 2
*
* This code uses ARC
*
* Copyright (c) 2006 - 2010 Jim McGowan
* All rights reserved.
@getaclue00
getaclue00 / PaddedNSTextFieldCell.swift
Created August 10, 2018 16:31
Padding Custom Margins In NSTextField
//
// PaddedNSTextField.swift
// reference - https://stackoverflow.com/a/38138336
import Cocoa
class PaddedNSTextFieldCell: NSTextFieldCell {
@IBInspectable var leftPadding: CGFloat = 8.0
@getaclue00
getaclue00 / RoundedTextFieldCell.swift
Created August 10, 2018 16:28
RoundedTextFieldCell
//
// RoundedNSTextFieldCell.swift
//
// https://stackoverflow.com/a/40065608
import Cocoa
class RoundedTextFieldCell: NSTextFieldCell {
@IBInspectable var borderColor: NSColor = .clear