Skip to content

Instantly share code, notes, and snippets.

@lukasz-kaniowski
lukasz-kaniowski / thor.sh
Created November 8, 2011 15:37
thor_completion - bash completion for thor
_thorcomplete() {
COMPREPLY=($(compgen -W "`thor list | grep thor | cut -d " " -f 2`" -- ${COMP_WORDS[COMP_CWORD]}))
return 0
}
complete -o default -o nospace -F _thorcomplete thor
@lukasz-kaniowski
lukasz-kaniowski / gitconfig
Created December 12, 2012 00:54
Git aliasses and ignores
[color]
ui = auto
[alias]
co = checkout
br = branch
ci = commit
st = status
track = !sh -c 'git checkout --track -b $1 origin/$1' -
f = fetch
fstart = !sh -c 'git push origin devel:refs/heads/features/$1 && git checkout --track -b features/$1 origin/features/$1' -
@lukasz-kaniowski
lukasz-kaniowski / install.sh
Created February 16, 2013 22:06
Creating angular project using yeoman 1.0-beta
gem install cucumber
mkdir project && cd project
npm install -g yo grunt-cli bower
npm install generator-angular generator-testacular
yo angular
npm install && bower install
bower install angular-ui
grunt server
@lukasz-kaniowski
lukasz-kaniowski / controller_spec.js
Created April 10, 2013 20:54
angular jasmine tests
describe('Controller: TasksCtrl', function () {
// load the controller's module
beforeEach(module('yeomanAngularApp'));
var TasksCtrl,
scope,
tasks = { getAll: function () {
return [
{name: 'task_1'}
@lukasz-kaniowski
lukasz-kaniowski / spec.js
Last active December 16, 2015 08:09
angular js testing promises
// incject
inject(function(_$rootScope_, _$controller_, _$q_, _$injector_) {...}
// when
when(function(){
deferred.resolve({model: 'balba'});
$rootScope.$digest();
})
function MockService() {
@lukasz-kaniowski
lukasz-kaniowski / gist:5750007
Created June 10, 2013 16:11
curl for jenkins jobs condition
result=`curl http://localhost:8090/test`
echo "Result is '$result'"
if [[ "$result" == *"false"* ]]; then
exit 1
fi
exit 0
@lukasz-kaniowski
lukasz-kaniowski / multiplePromisesSpec.js
Last active December 24, 2015 22:08
Promise testing
var customerService, deferredCustomer, sampleCustomer,
productService, deferredProduct, sampleProduct;
beforeEach(function () {
sampleCustomer = {name:'Bob'};
customerService = { get:sinon.stub() };
productService = { get:sinon.stub() };
sampleProduct = { type: 'Product'}

Creating new project with ionic framework using yeoman ionic generator:

$ mkdir my-ionic-project && cd $_
$ yo ionic

Links:

@lukasz-kaniowski
lukasz-kaniowski / Dockerfile
Created May 31, 2016 19:29 — forked from loudnate/Dockerfile
DockerHub:loudnate/openaps-dev
# Pull base image
FROM resin/rpi-raspbian:wheezy
MAINTAINER Nathan Racklyeft <[email protected]>
# Install dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git \
python \
@lukasz-kaniowski
lukasz-kaniowski / backup.js
Created July 12, 2017 14:07
Streaming backup of mongodb 3.2
const fs = require('fs')
const writeStream = fs.createWriteStream('out.db')
const { spawn } = require('child_process');
const mongodump = spawn('mongodump', ['--archive', '--db', 'databaseName']);
mongodump.stdout.pipe(writeStream);