Skip to content

Instantly share code, notes, and snippets.

View barbagrigia's full-sized avatar

Vlad Trukhin barbagrigia

View GitHub Profile
@barbagrigia
barbagrigia / core.cljs
Created November 15, 2016 23:21 — forked from roman01la/core.cljs
Reagent + react-motion
;; Reagent component
(defn new-task-input-component [props]
(let [new-task (subscribe [:get-new-task])]
[view
{:style (assoc (:slide-up styles) :transform [{:translateY (- (:y props))}])}
[input {:style (:input styles)
:default-value @new-task
:auto-focus true
:on-change-text #(dispatch [:set-new-task %])
:on-submit-editing #(do
@barbagrigia
barbagrigia / webpack.js
Created November 21, 2016 14:58 — forked from Couto/webpack.js
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};
angular
.module('PersonMod', [])
.factory('Person', function () {
function Person() {};
Person.create = function (data) {
return new Person(data);
};
return Person;
})
.service('PersonLoader', [function() {
extends: eslint:recommended
plugins:
- output-todo-comments
parserOptions:
ecmaVersion: 8
env:
node: true
mocha: true
es6: true
rules:
@barbagrigia
barbagrigia / shouldReturnPromise.js
Last active March 15, 2017 22:23
shouldReturnPromise - к слову я с некоторых пор весь код функции обычно держу в промисе, чтобы любые синхронные/асинхронные исключения были пойманы
function shouldReturnPromise (param) {
return Promise.resolve()
.then(() => {
if (param === undefined) { throw new Error() } // можно кинуть исключение, и промис реджекнется
if (param) { return Promise.resolve(true) } // можно вернуть промис
return false // можно вернуть значение
})
}
@barbagrigia
barbagrigia / export-syntax.js
Created March 15, 2017 22:59 — forked from caridy/export-syntax.js
ES6 Module Syntax Table
// default exports
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}
@barbagrigia
barbagrigia / DEVTOOLS.md
Last active September 29, 2020 17:59
DevTools
  1. 🐶 Husky Git hooks made easy. Husky can prevent bad commit, push and more 🐶 woof!
  2. JSONPlaceholder is a simple fake REST API for testing and prototyping
  3. JSON Server Get a full fake REST API with zero coding in less than 30 seconds (seriously)
  4. 🏩 Hotel A simple process manager for developers. Start apps from your browser and access them using local .dev domains
  5. ghwn Get desktop notifications for new issues, comments, stars... (no installation required)
  6. pkg-ok Prevents publishing a module with bad paths 👌
  7. 📷 tlapse Create a timelapse of your web development... or just automatically take screenshots of your hard work
  8. [:mountain_railway: barraks](https://github.com/yoshuawuyts/barracks
@barbagrigia
barbagrigia / gist:e475e35dbe7445cd3f37689597bbe869
Created March 28, 2017 19:54 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@barbagrigia
barbagrigia / CSS-svg-with-fallback.css
Created April 4, 2017 16:17
CSS SVG background and fallback including background size and positioning
/*I've seen a bunch of these around the net (e.g. http://pauginer.com/post/36614680636/invisible-gradient-technique and https://css-tricks.com/a-complete-guide-to-svg-fallbacks/) but they all lacked dealing with positioning of allowed two images to show (the first example).*/
.thing {
/* Setting source, position, size and no-repeat as per https://developer.mozilla.org/en/docs/Web/CSS/background */
background: url("../images/Account.png") center left / 22px auto no-repeat;
/* If you understand linear-gradients you will understand SVG too */
background: linear-gradient(transparent, transparent), url("../images/Account.svg") center left / 22px auto no-repeat;
}
/*However, old Android doesn't like size values in the shorthand (source: http://caniuse.com/#search=background-image) so instead we need to do this:*/