Skip to content

Instantly share code, notes, and snippets.

😌

Iulia Maria Lungu iuliaL

😌
Block or report user

Report or block iuliaL

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View frozen-not-immutable.js
const a = Object.freeze({
foo: { greeting: 'Hello' },
bar: 'world',
baz: '!'
});
a.foo.greeting = 'Goodbye';
console.log(`${ a.foo.greeting }, ${ a.bar }${a.baz}`);
@ericelliott
ericelliott / no-timing-dependency.js
Last active Oct 23, 2017
Pure functions have no timing dependency issues.
View no-timing-dependency.js
const x = {
val: 2
};
const x1 = x => Object.assign({}, x, { val: x.val + 1});
const x2 = x => Object.assign({}, x, { val: x.val * 2});
console.log(x1(x2(x)).val); // 5
View timing-dependency.js
// With shared state, the order in which function calls are made
// changes the result of the function calls.
const x = {
val: 2
};
const x1 = () => x.val += 1;
const x2 = () => x.val *= 2;
View remove-all-from-docker.sh
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
anonymous
anonymous / flexbox.sass
Created Aug 1, 2016
FlexBox mixins (with vendors) and utils
View flexbox.sass
//**************************************************************************************************** [ FLEXBOX ]
=flexbox
display: -webkit-box
display: -moz-box
display: -ms-flexbox
display: -webkit-flex
display: flex
// align flex items along the main axis of the current line of the flex container: flex-start | flex-end | center | space-between | space-around
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active Nov 15, 2019
Git HowTo: revert a commit already pushed to a remote repository
View revert-a-commit.md

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@beaucharman
beaucharman / debounce.js
Last active Nov 12, 2019
An ES6 implementation of the debounce function. "Debouncing enforces that a function not be called again until a certain amount of time has passed without it being called. As in 'execute this function only if 100 milliseconds have passed without it being called.'" - CSS-Tricks (https://css-tricks.com/the-difference-between-throttling-and-debounc…
View debounce.js
function debounce(callback, wait, immediate = false) {
let timeout = null
return function() {
const callNow = immediate && !timeout
const next = () => callback.apply(this, arguments)
clearTimeout(timeout)
timeout = setTimeout(next, wait)
View BitBucket Centos add ssh key
cd ~/.ssh
ssh-keygen -t rsa
cat id_rsa.pub
copy key
go to BitBucket -> Accounts -> Security -> SSH -> Add key -> Paste key
go to server -> Before we begin, navigate to your repository on the Bitbucket website and copy its SSH URL. This will be in the format git@bitbucket.org:<username>/<repo-name>.git
example: git clone --mirror git@bitbucket.org:<username>/<repo-name>.git
Notice the --mirror flag? As its name implies this flag creates an exact mirror of the source repository, including mapping it’s remote branches. It implies --bare, which means that our repository will not have a working copy.
@irazasyed
irazasyed / homebrew-permissions-issue.md
Last active Nov 19, 2019
Homebrew: Permissions Denied Issue Fix (OS X / macOS)
View homebrew-permissions-issue.md

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@victorb
victorb / app.js
Created Sep 24, 2013
Easy AngularJS Directive for Google Places Autocomplete
View app.js
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};
You can’t perform that action at this time.