Skip to content

Instantly share code, notes, and snippets.

View dmitriz's full-sized avatar

Dmitri Zaitsev dmitriz

View GitHub Profile
<script>
$(document).ready(function() {
// Check whether the browser is capable of speech synthesis
if (window.speechSynthesis != 'undefined') {
// Basic demo
$("#demo_1").on('click', function(e) {
var u = new SpeechSynthesisUtterance('You have reached your destination');
@dmitriz
dmitriz / backbone-itemstodo-minimized.html
Last active October 11, 2015 11:47
Here is my attempt to hack the popular Jerome Gravel-Niquet's Backbone Todo App down to a MVA (Minimum Workable App).
<!--
Web Application with Backbone: BEGINNER TUTORIAL
Backbone.js is a very popular and light(weight) JavaScript library
for building Web Applications.
However, learning it I found frustratingly few simple examples of
true workable applications with all lines of code explained.
Here is my attempt to hack the popular Jerome Gravel-Niquet's Backbone Todo App
@ewnd9
ewnd9 / npm-wrapper.sh
Last active January 18, 2016 11:02
Prevent executing "npm install <deps>" without `-S`, `-D`, `--save`, `--save-dev`, `-g` flags
#!/bin/bash
set -e
if ([ "$1" == "install" ] || [ "$1" == "i" ]) && [ "$#" -ne 1 ]; then
for var in "$@"
do
if [ "$var" == "--save" ] || [ "$var" == "--save-dev" ] || [ "$var" == "-S" ] || [ "$var" == "-D" ] || [ "$var" == "-g" ]; then
has_modifier=true
fi
@dmitriz
dmitriz / .jshintrc.js
Created January 25, 2016 21:35 — forked from connor/.jshintrc.js
jshintrc example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
# avoid "works on my machine" by always locking dependency versions
npm config set save-exact=true
# install/uninstall project packages with flags that will update package.json
npm install --save lodash
npm install --save-dev jshint
npm uninstall --save lodash
# tool that makes upgrading dependencies easier, install it globally
npm install -g david
@mikaelbr
mikaelbr / 01-functional-ui.js
Last active February 21, 2017 23:50
Example of functional UI and higher order components for React/Omniscient.js (http://omniscientjs.github.io/)
import React from 'react';
import component from 'omniscient';
import immstruct from 'immstruct';
import { compose, valueNode, partialProps } from './compose';
const data = immstruct({ counter: 0, title: 'My title' });
const em = component(({partialedTitle, children}) =>
<em>{partialedTitle}: {children}</em>);
// my initial code from https://github.com/bevry/outpatient/blob/455fd3a32791259931e0fa4e3b9b3b7d1dc26d8b/source/block.js#L55-L75
'use strict'
const h = require('hyperscript')
module.exports = function (opts = {}) {
// Prepare
const { document, content } = this
const {
permalink = document.url,
var gulp = require('gulp');
// Let's make things more readable by
// encapsulating each part's setup
// in its own method
function startExpress() {
var express = require('express');
var app = express();
app.use(express.static(__dirname));
@sukima
sukima / node_modules-in-git.md
Created October 8, 2012 20:50
Archive of mikeal's post since his server went down today

node_modules in git

December 10 2011
By mikeal

One of the many things we have been forced to rethink in the world of node is how we handle dependencies in applications.

One of the big changes that came with 0.4.0 was support for node_modules. This change had major consequences. It elevated local modules, in a local directory, above modules installed globally. Along with npm changing its default install preference to local rather than global we've seen a nearly unanimous shift to local module installs that has made global installs somewhat distasteful.

@dmitriz
dmitriz / style_guide.md
Created April 19, 2018 16:39 — forked from dominictarr/style_guide.md
style guide

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.