Skip to content

Instantly share code, notes, and snippets.

View ahmed1490's full-sized avatar

Ahmed Abbas ahmed1490

View GitHub Profile
@simpsoka
simpsoka / Leadership-CI.md
Last active December 20, 2023 15:40
This is a list of questions to check our decision making.

Do I want to die on this hill?

  • Pass: This is morally good and if not handled has long term consequences
  • Fail: This if self serving

Am I including everyone?

  • Pass: My ego is not driving this conversation
  • Fail: The people in this conversation will only tell me I'm right and not push back
@ContrastingSounds
ContrastingSounds / State Machine Spreadsheet to PDF Diagrams.ipynb
Last active April 3, 2024 11:50
Generate state machine diagrams automatically from a spreadsheet of states and transitions. Supports Google Sheets and Excel.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Rich-Harris
Rich-Harris / footgun.md
Last active July 8, 2024 03:54
Top-level `await` is a footgun

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological

@nidorx
nidorx / index.android.js
Created July 8, 2016 17:57
React Native - Section ListView with search input
/**
* Inspired by "MyASUS - ASUS support" version 2016 https://play.google.com/store/apps/details?id=com.asus.ia.asusapp
* Colors: https://material.google.com/style/color.html#color-color-palette
*
* See online - https://rnplay.org/apps/7qet3A
*/
import React, { Component, } from 'react';
import {
AppRegistry,
@lauterry
lauterry / app.js
Last active August 10, 2016 22:53
nuka-carousel + react-modal = :( - workaround - https://github.com/kenwheeler/nuka-carousel/issues/120
'use strict';
import Carousel from "../src/carousel";
import React from "react";
import ReactDom from "react-dom";
import Modal from "react-modal";
window.React = React;
const App = React.createClass({
@lauterry
lauterry / app.js
Last active August 11, 2016 00:01
nuka-carousel + react-modal = :( - https://github.com/kenwheeler/nuka-carousel/issues/120
'use strict';
import Carousel from '../src/carousel';
import React from 'react';
import ReactDom from 'react-dom';
import Modal from 'react-modal';
window.React = React;
const App = React.createClass({

architectures and whatnot

  1. plain ol' React
let state = initial
render(view(state), element)
  • view is pure!
import * as types from '../constants';
import combineTypes from '../utils';
const item = (state, action) => {
const actions = {
[types.UPDATE_ITEM_SIZE_REQUEST]: () => ({
...state,
isUpdatingSize: true
}),
[types.UPDATE_ITEM_SIZE_SUCCESS]: () => action.payload,
// import Setting from React up here
function setHasLocationPermission(hasPerm) {
Settings.set({hasLocationPermission: hasPerm});
}
navigator.geolocation.getCurrentPosition(
(position) => setHasLocationPermission(true),
(error) => {