Skip to content

Instantly share code, notes, and snippets.

View iuliaL's full-sized avatar
♾️

Iulia Maria Lungu iuliaL

♾️
View GitHub Profile
@beaucharman
beaucharman / debounce.js
Last active February 25, 2022 20:35
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…
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)
@victorb
victorb / app.js
Created September 24, 2013 16:37
Easy AngularJS Directive for Google Places Autocomplete
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, model) {
var options = {
types: [],
componentRestrictions: {}
};
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.
@ericelliott
ericelliott / frozen-not-immutable.js
Created January 3, 2017 21:35
Frozen, not immutable
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 / timing-dependency.js
Created January 3, 2017 00:42
Timing dependency
// 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;
@ruiwen
ruiwen / fb-angular.js
Last active July 5, 2017 10:40
Wrapping and initialising the Facebook SDK with Angular JS
// Facebook SDK
angular.module('facebook', [])
.directive('fb', ['$FB', function($FB) {
return {
restrict: "E",
replace: true,
template: "<div id='fb-root'></div>",
compile: function(tElem, tAttrs) {
return {
post: function(scope, iElem, iAttrs, controller) {
anonymous
anonymous / flexbox.sass
Created August 1, 2016 15:18
FlexBox mixins (with vendors) and utils
//**************************************************************************************************** [ 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