Skip to content

Instantly share code, notes, and snippets.

View pgarciacamou's full-sized avatar
:octocat:

Pablo Garcia pgarciacamou

:octocat:
View GitHub Profile
@softwarespot
softwarespot / window.onerror.js
Created May 27, 2018 17:53
Listen for uncaught errors using window.addEventListener('error', ...)
<script>
window.addEventListener('error', (event) => {
const { message, filename, lineno, colno, error } = event;
console.log('Captured uncaught error:', message, filename, lineno, colno, error.stack);
});
setTimeout(() => {
try {
throw new Error('An unexpected error occurred (2)');
} catch (ex) {
@petertwise
petertwise / Gruntfile.js
Created May 9, 2018 00:03
My Grunt Setup - no ruby required version
// inspired by https://gist.github.com/jshawl/6225945
// Thanks @jshawl!
// now using grunt-sass to avoid Ruby dependency
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: { // sass tasks
dist: {
@jbritton
jbritton / graphql-cheat-sheet.md
Last active January 4, 2024 21:46
GraphQL Cheat Sheet

GraphQL Cheat Sheet

Overview

  • An alternative approach to RESTful APIs
  • Clients issue queries/mutations to read and update data
  • Clients can fetch only the entity fields that are required
  • GraphQL query syntax can express complex entity relations => nested objects
  • Mitigates the explosion of RESTful endpoints in scenarios where many different representations of an entity are needed
  • Graphiql is a query execution UI, also provides good documentation
@ericclemmons
ericclemmons / example.md
Last active April 24, 2024 18:09
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@armw4
armw4 / redux-is-smarter-than-you-think.md
Last active June 19, 2021 20:10
Optimizing your react components via redux....shouldComponentUpdate for free and more...

The Beginning

Yes...it's true...redux is smart....smarter than you even know. It really does want to help you. It strives to be sane and easy to reason about. With that being said, redux gives you optimizations for free that you probably were completely unaware of.

connect()

connect is the most important thing in redux land IMO. This is where you tie the knot between redux and your underlying components. You usually take state and propogate it down your component hiearchy in the form of props. From there, presentational

@mxstbr
mxstbr / Readme.md
Last active December 20, 2023 12:01
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
@ruffle1986
ruffle1986 / redux-reducer-immutability-test.js
Created September 24, 2015 15:50
redux reducer immutability test
import test from 'ava';
import * as actionTypes from './your-action-types';
import reducer from './your-reducer';
import deepEqual from 'deep-equal';
test('reducer:immutability test', t => {
const dummy = {};
for (const action in actionTypes) {
if (actionTypes.hasOwnProperty(action)) {
const result = reducer(dummy, {type: actionTypes[action]});
@paulirish
paulirish / what-forces-layout.md
Last active May 21, 2024 09:11
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@walkerjeffd
walkerjeffd / Synology-Diskstation-Git.md
Last active May 19, 2024 21:30
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@rxaviers
rxaviers / gist:7360908
Last active May 23, 2024 07:41
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: