Skip to content

Instantly share code, notes, and snippets.

View connor4312's full-sized avatar

Connor Peet connor4312

View GitHub Profile
@connor4312
connor4312 / gist:7f541daf82d7b6b12314
Last active August 29, 2015 14:01
Javascript Semi-Signficant Figures
/**
Handy function to get (kind of) significant figures from Javascript numbers.
Unlike built-in Javascript methods, this works for all numbers, not just decimals.
Example: sigFigs(12345, 2) -> 12000
sigFigs(0.022, 1) -> 0.02
**/
function sigFigs(num, figures) {
@connor4312
connor4312 / gist:af385d566f016a634a54
Last active August 29, 2015 14:03
A Tiny jQuery Plugin
#########################################################################
# Tiny jQuery plugin that lets us do actions on hidden elements, so we
# can grab heights and such!
##########################################################################
$.fn.whileHidden = (action, args...) ->
r = @show()[action](args...)
@hide()
return r
@connor4312
connor4312 / gist:ec15140e972dc27ae465
Last active August 29, 2015 14:06
Find an angular element by in a scope.
/**
* Simple jquery extension to find all elements in a certain Angular scope.
* Usage:
*
* var myElement = $.inScope('.item', $scope);
*
* @param {string} selector
* @param {Angular.Scope} $scope
* @returns {jQuery}
*/
@connor4312
connor4312 / keybase.md
Created September 23, 2014 17:07
keybase.md

Keybase proof

I hereby claim:

  • I am connor4312 on github.
  • I am connor4312 (https://keybase.io/connor4312) on keybase.
  • I have a public key whose fingerprint is FA2F 304A 6F30 FA57 3AF1 01B9 D3E9 CF94 E8B4 FC36

To claim this, I am signing this object:

@connor4312
connor4312 / calculator.js
Created February 7, 2016 15:37
Beam Level Calculator
function Calculator() {
this.flushCache();
}
/**
* Clears the calculator's cache. Mainly for debugging.
*/
Calculator.prototype.flushCache = function () {
this.cache = [{ xp: 0, level: 0 }];
};
@connor4312
connor4312 / earthsong.tmTheme
Created October 6, 2016 16:49
Earthsong theme for vs code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
======================================================================
Earthsong
======================================================================
A Sublime Text 2 / Textmate theme.
Copyright (c) 2014 Dayle Rees.
Released under the MIT License <http://opensource.org/licenses/MIT>
======================================================================
import { ShortCodeAccessDeniedError, ShortCodeExpireError, UnexpectedHttpError } from './errors';
import { delay, Fetcher, IRequester } from './util';
// note: this is a functional port of the Python version here:
// https://github.com/mixer/interactive-python/blob/master/interactive_python/oauth.py
export interface IShortcodeCreateResponse {
code: string;
expires_in: number;
handle: string;
@connor4312
connor4312 / settings.json
Created November 8, 2019 04:59
My theme settings
{
"workbench.colorTheme": "Earthsong",
"workbench.colorCustomizations": {
"activityBar.background": "#2F2B26",
"statusBar.noFolderBackground": "#2F2B26",
"activityBarBadge.background": "#D76538",
"sideBar.background": "#2F2B26",
"sideBarSectionHeader.background": "#26221E",
"activityBar.foreground": "#7a7a7a",
"statusBar.background": "#36312C",
@connor4312
connor4312 / log.json
Created December 2, 2019 19:20
Unordered console output
This file has been truncated, but you can view the full file.
{"timestamp":1575313871152,"tag":"runtime.welcome","level":1,"message":"js-debug v0.9.0 started","metadata":{"os":"darwin x64","nodeVersion":"v12.4.0","adapterVersion":"0.9.0"}}
{"tag":"dap.receive","timestamp":1575313871147,"metadata":{"message":{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code - Insiders","adapterID":"pwa-node","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"},"type":"request","seq":1}},"level":0}
{"tag":"dap.send","timestamp":1575313871148,"metadata":{"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":false,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"caught","label":"Caught Exceptions","default":false},
@connor4312
connor4312 / index.html
Created June 16, 2020 23:37
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>iframe:</h1>
<iframe width="560" height="100" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>