Skip to content

Instantly share code, notes, and snippets.

@pavelbinar
pavelbinar / yeoman-commands.sh
Last active December 28, 2015 07:29
Terminal: Yeoman commands
# Yeoman Commands
# Install new generator
npm install -g yo generator-[nameOfGenerator]
# Uninstall generator
npm uninstall -g yo generator-[nameOfGenerator]
# Example
npm install -g generator-angular # install generator
@pavelbinar
pavelbinar / event-listener.js
Last active December 28, 2015 13:29
JavaScript: Example - Event listener
// Source: http://coding.smashingmagazine.com/2013/11/12/an-introduction-to-dom-events/
var element = document.getElementById('element');
function callback() {
alert('Hello');
}
// Add listener
element.addEventListener('click', callback);
@pavelbinar
pavelbinar / app.js
Created November 20, 2013 09:58
JavaScript: Add active class to clicked menu item
$('#menu li').each(function(index) { $(this).click(function() {
$('#menu li').removeClass('active');
$('#menu li:eq(' + index + ')').addClass('active'); });
});
@pavelbinar
pavelbinar / gitignore-fix.sh
Created November 25, 2013 13:09
.gitignore fix
git rm -r --cached .
git add .
git commit -m "fixing .gitignore"
@pavelbinar
pavelbinar / gist:7899310
Created December 10, 2013 20:50
Git ignore fix
git rm -r --cached .
git add .
git commit -m "fixing .gitignore"
# For test
$ for filename in IMG_*; do echo mv \"$filename\" \"${filename//IMG_/Fireworks}\"; done
# for rename files
$ for filename in IMG_*; do echo mv \"$filename\" \"${filename//IMG_/Fireworks}\"; done | /bin/bash
@pavelbinar
pavelbinar / gist:8236408
Created January 3, 2014 11:19
ffmpeg -i video.mp4 -vcodec libvpx-vp9 -strict experimental output.webm
-> ffmpeg -i video.mp4 -vcodec libvpx-vp9 -strict experimental output.webm
ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Jan 2 2014 22:34:47 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libavresample 1. 1. 0 / 1. 1. 0
@pavelbinar
pavelbinar / gist:8236426
Created January 3, 2014 11:22
ffmpeg -encoders
-> ffmpeg -encoders
ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Jan 2 2014 22:34:47 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libavresample 1. 1. 0 / 1. 1. 0
var fs = require('fs');
var templateSource = './template.conf',
templateDestination = './new-file.conf',
templateParameters = {
domainBody: 'pavelbinar',
domainExtension: '.cz'
};
var editTemplate = function (srcPath, destPath, replacements) {
var fs = require('fs');
var wwwDir = './';
//var wwwDir = '/var/www';
var apacheDir = './apache2';
//var apacheDir = '/etc/apache2';
domainBody = process.argv[2];
domainExtension = process.argv[3];