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
#!/bin/bash | |
SSH_USER="user@sftp.domain.com" # your sftp credentials | |
SSH_KEY="~/.ssh/id_rsa" # your ssh private key | |
DOCUMENT_ROOT="/www/vhosts/mywebsite.com/htdocs" # directory on the remote server | |
LOCAL_DIR="~/mywebsite.com/public" # directory on your local machine | |
REMOTE_DIR="_remote_dir" # temporary mount point | |
mkdir -p $REMOTE_DIR | |
sshfs $SSH_USER:$DOCUMENT_ROOT $REMOTE_DIR -o workaround=rename -o defer_permissions -o IdentityFile=$SSH_KEY |
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 { ApolloServer, gql } from 'apollo-server-micro'; | |
const typeDefs = gql` | |
type Query { | |
sayHello: String | |
} | |
`; | |
const resolvers = { | |
Query: { |
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
/* eslint-env node */ | |
const http = require('http'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const url = require('url'); | |
const { exec } = require('child_process'); | |
const { promisify } = require('util'); | |
const readFile = promisify(fs.readFile); |
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 Rx = require('Rx'); | |
require('babel/register'); | |
const Observables = require('./observables.es6'); | |
// Define a very simple, router-like object | |
class Router { | |
constructor() { | |
this.routes = {}; | |
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<!-- ... --> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> |
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
'use strict'; | |
const items = [ | |
{ id: 'a', group: 'x', count: 20 }, | |
{ id: 'b', group: 'x', count: 10 }, | |
{ id: 'c', group: 'x', count: 40 }, | |
{ id: 'c', group: 'y', count: 40 }, | |
{ id: 'c', group: 'y', count: 10 }, | |
{ id: 'c', group: 'y', count: 30 }, | |
{ id: 'c', group: 'z', count: 20 }, |
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
// @flow | |
import Koa from 'koa' | |
import Router from 'koa-router' | |
import { Observable, Subject } from 'rxjs/Rx' | |
type Epic = (observable: Observable) => Observable | |
const epic1 = observable => | |
observable.map(({ctx}) => { |
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
function promiseFirst(promises) { | |
function tryResolve([x, ...xs], resolve, reject) { | |
if (xs.length > 0) | |
x.then(resolve).catch(_ => tryResolve(xs, resolve, reject)) | |
else | |
x.then(resolve).catch(reject) | |
} | |
return new Promise((resolve, reject) => | |
tryResolve(promises, resolve, reject) | |
) |
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
def fn_foo(data_one, data_two): | |
for element_x in select_element(data_one, lambda key, value, parent: key == | |
'type' and value == 'example' and 'flip' in parent and 'flop' in parent): | |
for element_y in select_element(data_two, lambda key, value, parent: key == | |
'flip' and value == element_y['flip']): | |
element_x['flop'] = element_y['flop'] |
NewerOlder