Skip to content

Instantly share code, notes, and snippets.

View a7madgamal's full-sized avatar

Ahmed Hassanein a7madgamal

View GitHub Profile
@JulienHe
JulienHe / mouthposition.js
Created December 9, 2019 06:42
Spark AR - Mouth Corner
/**
* Author: Julien Henrotte @julien_he
* Company: UltraSuperNew http://ultrasupernew.com/
*/
/**
* Modules
*/
const Scene = require('Scene');
const FaceTracking = require('FaceTracking');

Proposal: ts.DiagnosticPlugin and tswarn

The Angular team owns a couple of tools that would like to extend the diagnostics produced by the TypeScript compiler:

  • tsetse is our set of third-party --strict checks. So far, these are wired into our custom Bazel tsc compiler, tsc_wrapped, and they produce only Severity.ERROR diagnostics. See http://tsetse.info

  • Angular Ivy is a new rendering engine for Angular, and it allows a simpler compiler pipeline which we hope can fit entirely within tsc given a plugin model for producing extra diagnostics (such as semantic or type errors within Angular template

@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@verticalgrain
verticalgrain / app.js
Last active April 26, 2022 15:37
React Router V4 Redirect after form submission
import React, { Component } from 'react'
import { Redirect } from 'react-router'
export default class ContactForm extends Component {
constructor () {
super();
this.state = {
fireRedirect: false
}
}
@ggauravr
ggauravr / array_iteration_thoughts.md
Last active October 3, 2021 02:40 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@jaysoo
jaysoo / webpack.config.js
Last active November 6, 2023 03:31
Minimum webpack config for development
// 1. npm init
// 2. npm install --save webpack webpack-dev-server babel-loader babel-preset-es2015
// 3. mkdir dist && touch index.html
// 4. Include `<script src="/bundle.js"></script>` inside index.html
// 5. mkdir src && touch src/index.js
// 6. Add some code to index.js (e.g. `console.log('Hello, World!'))
// 7. npm start
// 8. Browse to http://localhost:8080/dist/
const webpack = require('webpack')
@TrevorSayre
TrevorSayre / styles.less
Last active April 16, 2017 14:45
Atom custom style to add git file status icons to tree-view
// This was created while using the Seti theme
// Adjust to your taste
// Default
// @left: 0; @top: 0;
// Left
@left: 0.7em; @top: 0.6em;
// Right
@staydecent
staydecent / styles.less
Last active June 4, 2021 04:44
Smaller, more compact tab-bar for Atom.io
.tab-bar {
height: 34px;
padding: 0;
.tab {
-webkit-transform: none;
top: 2px;
line-height: 25px;
&.active {
@Shmiddty
Shmiddty / jstraining.js
Created December 30, 2013 19:47
JS Training Session 1: Variables, Functions, Arguments, Primitives, Objects, Properties, and References.
/****************
* Variables *
****************/
var foo = 99;
//"var" is the syntax used for declaring a variable. It doesn't matter what
//type of value you want to store in the variable, JavaScript doesn't care.
bar = 'banana';
//omitting the "var" keyword will still create a variable (if it doesn't
//already exist in the scope), but it will be implicitly global.
@a7madgamal
a7madgamal / passwordless_ssh
Last active January 1, 2016 07:29
passwordless ssh connection
# step 1: on local machine
# (for first time only!)
ssh-keygen -t rsa
#copy the result exactly
cat ~/.ssh/id_rsa.pub
# step 2:on remote machine
ssh-copy-id <remote>