Skip to content

Instantly share code, notes, and snippets.

View apedyashev's full-sized avatar

Alexey Pedyashev apedyashev

  • Bern, Switzerland
View GitHub Profile
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@apedyashev
apedyashev / pub-sub.js
Created February 9, 2017 13:22 — forked from reu/pub-sub.js
node.js redis pub-sub example
var redis = require("redis")
, subscriber = redis.createClient()
, publisher = redis.createClient();
subscriber.on("message", function(channel, message) {
console.log("Message '" + message + "' on channel '" + channel + "' arrived!")
});
subscriber.subscribe("test");
@apedyashev
apedyashev / gh-pages-deploy.md
Created December 10, 2016 10:35 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@apedyashev
apedyashev / Enhance.js
Created August 17, 2016 08:02 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@apedyashev
apedyashev / cicd_node_deploy.sh
Created December 28, 2015 18:30
CI/CD stript to deploy node.js app with forever
#!/bin/bash
# global deps:
# forever, grunt, bower
# setup:
# forever columns add dir
PROJECT_DIR_NAME=<PROJECT-DIR-NAME>
GIT_CLONE_URL=https://<GITHUBLOGIN>:<GITHUBPASS>@github.com/apedyashev/meanjs-jobs-aggregator.git
GIT_BRANCH_TO_DEPLOY=staging
BASEPATH=</some/path>
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
@apedyashev
apedyashev / butterbar.md
Created August 29, 2015 17:15
Butterbar
<div class="butterbar active"
	ng-class="{hidden: !inProgress}">
	<span class="bar">
		loading
	</span>
</div>
.butterbar {
<html>
<body>
<!-- really dirty! this is just a test drive ;) -->
<script type="text/javascript" src="https://raw.github.com/mozilla/pdf.js/gh-pages/build/pdf.js"></script>
<script type="text/javascript">
function renderPDF(url, canvasContainer, options) {
var options = options || { scale: 1 };
@apedyashev
apedyashev / 1088.js
Last active August 29, 2015 14:06 — forked from aheckmann/1088.js
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
console.log('\n===========');
console.log(' mongoose version: %s', mongoose.version);
console.log('========\n\n');
mongoose.connect('localhost', 'testing_1088');
mongoose.connection.on('error', function () {