Вся суть харча™ (на самом деле все далеко не так...)
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 amqp = require('amqplib'); | |
const uuid = require('uuid') | |
const CONSUMER_TAG = uuid.v4(); | |
const QUEUE_NAME = 'my_queue' | |
async function main() { | |
const conn = await amqp.connect('amqp://guest:guest@localhost:5672/%2F'); | |
const channel = await conn.createChannel(); | |
await channel.assertQueue(QUEUE_NAME); |
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
Andorra | AD | |
---|---|---|
United Arab Emirates | AE | |
Afghanistan | AF | |
Antigua and Barbuda | AG | |
Anguilla | AI | |
Albania | AL | |
Armenia | AM | |
Angola | AO | |
Antarctica | AQ | |
Argentina | AR |
focus on the gen 2 / DP75SDI
compile kernel + initramfs with openwrt:
- because it cross-compiles easily
- has a reasonably simple user-space
- device-tree?
CONFIG_PACKAGE_kmod-usb-gadget-serial
const Moment = require('moment')
const array = [{date:"2018-05-11"},{date:"2018-05-12"},{date:"2018-05-10"}]
const sortedArray = array.sort((a,b) => new Moment(a.date).format('YYYYMMDD') - new Moment(b.date).format('YYYYMMDD'))
console.log(sortedArray)
groupBy
-- разбивает массив на подмассивы по критериюkeyBy
-- то же самое, когда критерий не повторяетсяmap
,forEach
,find
умеют обходить объекты, очень удобноmapKeys
,mapValues
-- преобразование объектовtoPairs
иfromPairs
-- преобразовывает{foo: 'bar'}
в[['foo', 'bar']]
и обратноintersection
,difference
,union
-- взаимодействие нескольких массивовflatten
-- без него вообще не жизньflatMap
-- map+flatten, очень удобноfindIndex
,sortedIndex
-- когда тебе нужен только индекс элемента, а не сам элементfindKey
-- когда нужно найти ключ в объекте по критерию
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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" |
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
import React from 'react' | |
import axios, { post } from 'axios'; | |
class SimpleReactFileUpload extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state ={ | |
file:null | |
} |
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
import { Component } from "react"; | |
import { print } from "graphql-tag/printer"; | |
import { graphql } from "react-apollo"; | |
import { MockedProvider } from "react-apollo/test-utils"; | |
import { addTypenameToDocument } from "apollo-client/queries/queryTransform"; | |
import { mount } from "enzyme"; | |
import { withSavedPayments, SAVED_ACCTS_QUERY } from "../"; |
- https://github.com/djvirgen/virgen-acl
- "Simple in-memory ACL for node.js apps. Supports arbitrary roles and resources, including role/resource detection using a simple interface. Additionally supports custom assertions for more complex rules."
- Comments: "Simple and elegant, create your own checks. No middleware?"
- https://github.com/OptimalBits/node_acl
- "...a minimalistic ACL implementation inspired by Zend_ACL."
NewerOlder