Skip to content

Instantly share code, notes, and snippets.

@yaroslavya
yaroslavya / star vars declaration
Last active August 29, 2015 13:56
approach way to declare variables good vs bad in starwars universe
//bad
function(){
var force = 0;
for(var i=0; i<500; i++){
//using the force
force++;
}
var lightSaber = 0;
@yaroslavya
yaroslavya / say
Last active December 12, 2015 05:08
Answer to https://gist.github.com/rmurphey/576723 for say('Hello')('world!'); question, but in a very custom way.
function say(a){
var inner = function(b){
return say(a+b);
};
inner.toString = function(){
return a;
};
return inner;
@yaroslavya
yaroslavya / reassign_undefined.js
Created February 26, 2013 10:24
Reassigning undefined inside a function.
function changeUndefinedInside(undefined){
undefined=42;
var a=42;
console.log(undefined);//42
console.log(a===undefined);//true
};
changeUndefinedInside(undefined);
console.log(undefined);//undefined
@yaroslavya
yaroslavya / ko foreach customBinding
Created April 19, 2013 09:57
Custom binding that use current element inside foreach binding.
ko.bindingHandlers[customBindingName] = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var handler = valueAccessor();
handler(viewModel, e);
}
};
console.log('works');
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@yaroslavya
yaroslavya / docker_attach_to_shell
Last active January 23, 2019 23:38
attach to docker container shell
docker exec -it <container_name||container_hash> /bin/bash
@yaroslavya
yaroslavya / cannot connect to the docker daemon
Last active February 3, 2019 22:52
cannot connect to the docker daemon redhat/centos/fedora/manjaro
sudo groupadd docker
sudo usermod -aG docker $(whoami)
sudo systemctl start docker
sudo chgrp docker /lib/systemd/system/docker.socket
sudo chmod g+w /lib/systemd/system/docker.socket
@yaroslavya
yaroslavya / start_jenkins_in_docker
Last active February 13, 2019 21:58
run jenkins in a docker container
docker run -p 8080:8080 jenkins/jenkins:lts
# if this is resulting in the same error for kubectl commands against your gke:
gcloud auth login
# you should try this:
gcloud auth application-default login
# behavior was changed in gcloud v128, see here: https://cloud.google.com/sdk/docs/release-notes#12800_20160928
# kudos for details to this so answer: https://stackoverflow.com/questions/41507904/could-not-find-default-credentials