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 ResizeSensor from require('css-element-queries/src/ResizeSensor') | |
| export default { | |
| // this will run in addition to any mounted() hook on the component | |
| // using the mixin | |
| mounted () { | |
| this.$resizeSensor = new ResizeSensor(this.$el, () => { | |
| // per the docs (https://vuejs.org/v2/api/#Vue-set), | |
| // this lets you add a reactive data property that wasn't specified in the component's | |
| // data() { } hook |
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
| watch: { | |
| number: { | |
| handler: function (newValue, oldValue) { | |
| // do your update here | |
| }, | |
| immediate: true | |
| } |
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
| let blacklists = ["https://mail.google.com/*","https://www.duolingo.com/*","https://trello.com/*","http://null-null-null.github.io/*","file:///*"] |
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 [J grad] = nnCostFunction(nn_params, ... | |
| input_layer_size, ... | |
| hidden_layer_size, ... | |
| num_labels, ... | |
| X, y, lambda) | |
| %NNCOSTFUNCTION Implements the neural network cost function for a two layer | |
| %neural network which performs classification | |
| % [J grad] = NNCOSTFUNCTON(nn_params, hidden_layer_size, num_labels, ... | |
| % X, y, lambda) computes the cost and gradient of the neural network. The | |
| % parameters for the neural network are "unrolled" into the vector |
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 { useState, useEffect } from 'react'; | |
| type State<T> = { | |
| data?: T; | |
| error?: T; | |
| }; | |
| export default function useAsync<T>( | |
| getData: () => Promise<T>, | |
| deps: readonly any[], |
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
| interface Serialized { | |
| a: string, | |
| b: string, | |
| c: string | string[], | |
| } | |
| interface Deserialized { | |
| field: number, //parsed from a | |
| otherField: string, // parsed from b | |
| yetAnotherField: string[] // parsed from c |
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 { useState, useEffect, useRef } from 'react'; | |
| type State<T> = { | |
| data?: T; | |
| error?: any; | |
| }; | |
| export default function useAsync<T>( | |
| getData: () => Promise<T>, | |
| deps: readonly any[], |
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 {Plugin} from 'vite'; | |
| import fs from 'fs'; | |
| const index = fs.readFileSync(__dirname + '/index.html', 'utf-8'); | |
| const fileUrls: Plugin = { | |
| name: 'pass-through-file-urls', | |
| configureServer: server => { | |
| server.middlewares.use(async (req, res, next) => { | |
| if (req.url?.match(/.*\/files\/.*$/)) { |
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
| // ...and the encoder is turned counter-clockwise, send Shift+Tab | |
| const key_override_t encoder_prev_app = ko_make_basic(MOD_MASK_GUI, KC_VOLD, G(S(KC_TAB))); | |
| // ...and the encoder is turned clockwise, send Tab | |
| const key_override_t encoder_next_app = ko_make_basic(MOD_MASK_GUI, KC_VOLU, G(KC_TAB)); | |
| // when the Opt key is held... | |
| // ...and the encoder is turned counter-clockwise, send Shift+Cmd+` |
OlderNewer