Skip to content

Instantly share code, notes, and snippets.

View koistya's full-sized avatar
🏠
Working from home

Konstantin Tarkus koistya

🏠
Working from home
View GitHub Profile
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
const State = React.createState();
function MyComponent(props) {
return (
<State
initialState={() => ({ counter: 0, lastProps: props, divRef: React.createRef() }) }
deriveState={state => ({ lastProps: props }) }
shouldUpdate={(state, nextState) => ... }
didMount={(state, setState) => ... }
getSnapshotBeforeUpdate={state => ... }
@karllhughes
karllhughes / 1-side-project-marketing-checklist.md
Last active April 6, 2023 23:52
Side Project Checklist Marketing

Setup Work

  • Make a list of competitive/alternative services: See competitors.md file
  • Set up Google News alerts for "side project marketing" and "startup marketing".
  • Make list of blogs, subscribe to RSS feeds in Feedbin:
    • Startup marketing blogs
    • Side project blogs
    • Small business marketing blogs
    • Chicago small business/startup bloggers
  • Come up with a name and domain name
@mosquito
mosquito / README.md
Last active May 10, 2024 15:57
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@thevangelist
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
@Entalyan
Entalyan / gist:c7db5160b8c1bbd9b353
Created February 20, 2016 20:15
AspNet-Server-Template DDL for Oracle 11g
/* DROP STATEMENTS */
DROP TABLE USER_ROLES;
DROP TABLE USER_LOGINS;
DROP TABLE USER_CLAIMS;
DROP TABLE USERS;
DROP SEQUENCE USER_ROLES_SEQ;
DROP SEQUENCE USER_LOGINS_SEQ;
DROP SEQUENCE USER_CLAIMS_SEQ;
DROP SEQUENCE USERS_SEQ;
@Entalyan
Entalyan / gist:a11c32afbaf3615ff795
Last active February 20, 2016 20:40
AspNet-Server-Template DDL for Oracle 12c
/* DROP STATEMENTS */
DROP TABLE USERS_USER_ROLES;
DROP TABLE USER_ROLES;
DROP TABLE USER_LOGINS;
DROP TABLE USER_CLAIMS;
DROP TABLE USERS;
/* USERS */
CREATE TABLE USERS
(
@idibidiart
idibidiart / GraphQL-Architecture.md
Last active September 16, 2023 18:36
Building an Agile, Maintainable Architecture with GraphQL

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.

With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.

We use GraphQL to dyn

@eyston
eyston / route.js
Last active October 19, 2016 13:10
Doing onEnter hooks with Relay that require data / async
const node = Relay.QL`
query {
node(id: $channelId) {
... on Channel {
joined
${JoinChannelMutation.getFragment('channel')}
}
}
}
`;

How to setup atom with nuclide plugins.

You need to install next packages

  • hyperclick
  • nuclide-diagnostics-store
  • nuclide-diagnostics-ui
  • nuclide-flow

You need to add .flowconfig