Skip to content

Instantly share code, notes, and snippets.

@romainl
romainl / typescript.md
Last active June 2, 2020 09:20
TypeScript ftplugin

TypeScript ftplugin

Attention! All this is a work in progress.

Include search

:help 'include' is set so that Vim recognizes both:

import Foo from 'foo';
@csprance
csprance / bad-words.ts
Created November 7, 2018 19:30
bad-words-list
export default [
'reallyReallyBadTestWord',
'5h1t',
'5hit',
'anal',
'ar5e',
'ass',
'ass-fucker',
'asses',
'assfucker',
@rachidbch
rachidbch / cvim.sheetcheat.md
Last active December 30, 2023 11:51
CVIM CheatSheet

Keybindings

  • j, s scroll down scrollDown
  • k, w scroll up scrollUp
  • h scroll left scrollLeft
  • l scroll right scrollRight
  • d scroll half-page down scrollPageDown
  •   scroll full-page down	scrollFullPageDown
    
  • u, e scroll half-page up scrollPageUp
  • scroll full-page up scrollFullPageUp
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@isogram
isogram / ubuntu-server.md
Last active May 10, 2023 08:39
Setup ubuntu server from scratch
@LeonardoCardoso
LeonardoCardoso / gitzip.sh
Last active October 9, 2023 22:38
Zip folder ignoring files listed on .gitignore
#...
function gitzip() {
git archive -o $@.zip HEAD
}
#... gitzip ZIPPED_FILE_NAME
@ebidel
ebidel / dom-property-watcher.js
Created September 12, 2015 17:01
DOM property watcher using ES6 proxies.
// Watch accesses/sets on a DOM element property.
function watchPropsOn(el) {
return new Proxy(el, {
get(target, propKey, receiver) {
//return Reflect.get(target, propKey, receiver);
console.log('get', propKey);
return el[propKey];
},
set(target, propKey, value, receiver) {
console.log('set', propKey, value);
@alonronin
alonronin / recurssive.tree.js
Last active August 26, 2023 09:23
Create recursive tree from json using lodash transform without recursion. Can have unlimited nesting.
var _ = require('lodash');
var arr = [
{"name":"my2child1","title":"My 2 Child 1","parent":"my2"},
{"name":"my2child2","title":"My 2 Child 2","parent":"my2"},
{"name":"parent","title":"A single parent"},
{"name":"child-parent","title":"A child parent","parent":"child1"},
{"name":"my","title":"My"},
{"name":"my2","title":"My2"},
{"name":"child1","title":"Child 1","parent":"my"},
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio