This file contains 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
const typedef = ` | |
interface Character { | |
name: String | |
} | |
type Human implements Character { | |
name: String | |
} | |
type Robot implements Character { |
This file contains 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
const _ = require('lodash') | |
const { Op } = require('sequelize') | |
const DataLoader = require('dataloader') | |
// eslint-disable-next-line | |
const createModelLoader = (Model, inField) => { | |
return new DataLoader(async (keys) => { | |
// Create id:index map for further use | |
const idIndexMap = keys.reduce((map, key, index) => { | |
map[key] = index |
This file contains 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
license: gpl-3.0 |
This file contains 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
license: mit |
This file contains 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
// App.js | |
import { getWebSocket } from './webSocket' | |
let ws = getWebSocket() | |
ws.send(...) | |
ws.onmessage = ev => { console.log(ev.data) } |
This file contains 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
node packages/create-react-app/index.js my-app-0.8.3 --scripts-version 0.8.3 | |
Creating a new React app in /Users/n3tr/Code/js/create-react-app/my-app-0.8.3. | |
Installing packages. This might take a couple minutes. | |
Installing react, react-dom, react-scripts... | |
yarn add v0.17.10 | |
info No lockfile found. | |
[1/4] Resolving packages... | |
[2/4] Fetching packages... |
This file contains 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
// ViewController.swift | |
class ViewController: NSViewController { | |
@IBOutlet weak var counterLabel: NSTextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
counterLabel.bind("stringValue", to: self, withKeyPath: #keyPath(currentCounter), options: nil) | |
} | |
} |
This file contains 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
// ViewController.swift | |
extension ViewController: NSTouchBarDelegate { | |
func touchBar(_ touchBar: NSTouchBar, makeItemForIdentifier identifier: NSTouchBarItemIdentifier) -> NSTouchBarItem? { | |
switch identifier { | |
// Increase Item | |
case NSTouchBarItemIdentifier.increase: | |
let button = NSButton(title: "+", target: self, action: #selector(ViewController.increaseCounter)) | |
let increaseItem = NSCustomTouchBarItem(identifier: identifier) |
This file contains 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
// ViewController.swift | |
class ViewController: NSViewController { | |
// (1) | |
dynamic var currentCounter = 0 | |
// ... | |
// (2) | |
func increaseCounter() { | |
currentCounter += 1 |
This file contains 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
class ViewController: NSViewController { | |
// ... | |
override func makeTouchBar() -> NSTouchBar? { | |
let touchBar = NSTouchBar() | |
touchBar.delegate = self | |
touchBar.customizationIdentifier = .counterTouchBar | |
touchBar.defaultItemIdentifiers = [.increase, .counter, .decrease] | |
return touchBar | |
} | |
} |
NewerOlder