This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
set -e | |
# Function to detect OS | |
detect_os() { | |
case "$(uname -s)" in | |
Linux*) echo "linux";; | |
Darwin*) | |
if [ "$(uname -m)" = "arm64" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { renderHook } from '@testing-library/react-hooks'; | |
import useInterval from './useInterval'; | |
describe('useInterval', () => { | |
beforeEach(() => { | |
jest.clearAllMocks(); | |
jest.useFakeTimers(); | |
}); | |
it('should run the callback after the delay', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
useHistory, | |
useLocation | |
} from 'react-router-dom'; | |
import queryString from 'query-string'; | |
import { renderHook } from '@testing-library/react-hooks'; | |
import useQueryStringState from './useQueryStringState'; | |
const mockHistory = { push: jest.fn() }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeout(ms = 1000) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am osbornm on github. | |
* I am osbornm (https://keybase.io/osbornm) on keybase. | |
* I have a public key whose fingerprint is 8BD9 6E8E FDFC 2468 BE9C E904 71E8 E463 8BA3 B85E | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview Disallow the use of Array.From() | |
*/ | |
"use strict"; | |
//------------------------------------------------------------------------------ | |
// Rule Definition | |
//------------------------------------------------------------------------------ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// asObservable or asObservableArray: if passed an observable use that instance otherwise wrap it in a new observable | |
var myModel = function(options){ | |
var self = this; | |
self.observable = ko.asObservable(options.possibleObservable); | |
self.observableArray = ko.asObservableArray(options.possibleObservableArray); | |
return self; | |
} | |
// Trackable Observables: the ability to revert to a "good" value | |
var myForm = function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var things = [ | |
new Thing1(), | |
new Thing1(), | |
new Thing2() | |
]; | |
var OnlyThingOnes = things.filter(function(t){return t.thingOneOnlyProperty !== undefined}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$cd = Add-Type -memberDefinition @" | |
[DllImport("winmm.dll", CharSet = CharSet.Ansi)] public static extern int mciSendStringA(string lpstrCommand, string lpstrReturnString, int uReturnLength, IntPtr hwndCallback); | |
"@ -passthru -name mciSendString\ | |
# Where F an G are the Drive letters | |
$cd::mciSendStringA("set cdaudio!F door closed wait", $null, 1, 1); | |
$cd::mciSendStringA("set cdaudio!G door closed wait", $null, 1, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.bindingHandlers.href = { | |
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) { | |
return ko.bindingHandlers['attr']['update'](element, function () { | |
return { href: valueAccessor() }; | |
}, allBindings, viewModel, bindingContext); | |
} | |
} |
NewerOlder