Skip to content

Instantly share code, notes, and snippets.

View gusgard's full-sized avatar
🏠
Working from home

Gustavo Gard gusgard

🏠
Working from home
  • Montevideo, Uruguay
View GitHub Profile

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@gusgard
gusgard / cloudSettings
Last active January 22, 2021 12:31
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-01-22T12:31:12.011Z","extensionVersion":"v3.4.3"}
@gusgard
gusgard / Event.js
Created August 22, 2017 19:34
Event wrapper
...
export default class Event {
static create(data) {
const event = new Event();
event.id = data.id;
event.name = data.name;
event.description = data.description;
event.pictureUrl = data.imageUrl;
@gusgard
gusgard / EventFacade.js
Created August 22, 2017 19:30
Event facade
import { HttpService } from 'App/src/common';
import Event from './Event';
class EventFacade {
static async create(payload) {
const event = Event.encode(payload);
const { data: { data } } = await HttpService.post('/events', event);
return Event.create(data);
@gusgard
gusgard / actions.spect.js
Created August 22, 2017 16:52
Actions test
import { expect } from 'chai';
import configureMockStore from 'redux-mock-store';
import nock from 'nock';
import thunk from 'redux-thunk';
import { API_URL } from 'App/src/config/environment';
import realmStore from 'App/src/store';
import actions from '../actions';
import {
@gusgard
gusgard / fix-homebrew-npm.md
Created March 31, 2017 00:28 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@gusgard
gusgard / introrx.md
Created April 11, 2016 03:08 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@gusgard
gusgard / gulpfile.js
Created March 29, 2016 16:35 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@gusgard
gusgard / tmux-cheatsheet.markdown
Created November 4, 2015 01:26 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname