Skip to content

Instantly share code, notes, and snippets.

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

Denis Prostatov dselkirk

🏠
Working from home
View GitHub Profile
// actions/list.js
import API from '../api'
export const FETCH_ITEMS = 'FETCH_ITEMS';
export const FETCH_ITEMS_SUCCESS = 'FETCH_ITEMS_SUCCESS';
export const FETCH_ITEMS_FAILURE = 'FETCH_ITEMS_FAILURE';
export function fetchItems() {
return {
type: FETCH_ITEMS,
payload: API.getList()
@dselkirk
dselkirk / example.styl
Last active March 18, 2017 18:17
code-example
@require '~styles/variables'
.notification
padding: 18px 0
background: $text-main
&__inner
position: relative
width: $container - 2*$container-left-right-padding
margin: 0 auto
<script type="text/javascript">
// First let's create an array of JavaScript Date
// objects.
// More info about the Date class:
// http://w3schools.com/js/js_obj_date.asp
var dates = [
new Date(2010, 4, 10, 10, 07, 16),
new Date(2010, 4, 8, 9, 16, 09),
new Date(2010, 3, 30, 0, 15, 49),
<div id="mySpeaker"></div>
$(function(){
// Call a custom plugin for your object on a dom element
$('#mySpeaker').speaker({'name': 'Alex'});
// Have quick access to the actual speaker object
var mySpeaker = $('#mySpeaker').data('speaker');
// The interface of the object that you build can
@dselkirk
dselkirk / leftmerge.js
Last active August 29, 2015 13:55
Merge only existing properties in Javascript objects
var mergeExistingProperties = function mergeExistingProperties(a, b) {
for (var i in b) {
if (a.hasOwnProperty(i)) {
if (typeof a[i] == 'object' && typeof b[i]== 'object')
mergeExistingProperties(a[i], b[i]);
else
a[i] = b[i]
}
}
return a;
@dselkirk
dselkirk / front-end-interview.js
Last active August 29, 2015 13:55
Front-end Inteview
// 1. Что выведет alert?
var myVar = 'test';
(function(){
//alert(myVar);
var myVar = 'hello';
})();
//2. What is the difference between these two functions?