Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Arshad Khan ar5had

🎯
Focusing
View GitHub Profile
@ar5had
ar5had / Local PR test and merge.md
Created Oct 29, 2017 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU
View Local PR test and merge.md

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: https://github.com/Psiphon-Labs/psiphon-tunnel-core/pull/37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
View css-boilerplate.css
:root {
--oc-white:#fff;
--oc-white-rgb:255,255,255;
--oc-black:#000;
--oc-black-rgb:0,0,0;
--oc-gray-0:#f8f9fa;
--oc-gray-0-rgb:248,249,250;
--oc-gray-1:#f1f3f5;
--oc-gray-1-rgb:241,243,245;
--oc-gray-2:#e9ecef;
View jsCheatsheet.js
// #1
// Polyfill a few basic things.
['filter', 'forEach', 'map', 'reduce'].forEach(function (name) {
Array[name] = function (array, callback, init) {
return [][name].call(array, callback, init);
};
});
// Automatically set up asynchronous JSON forms (all with a 'method' attribute).
// Array.forEach(document.querySelectorAll('form'), function (form) { ....
@ar5had
ar5had / ReactIgnore
Created Jul 25, 2017 — forked from alexeisavca/ReactIgnore
A simple component to make ReactJs ignore subtrees
View ReactIgnore
var React = require('react/addons');
var ReactIgnore = {
displayName: 'ReactIgnore',
shouldComponentUpdate (){
return false;
},
render (){
return React.Children.only(this.props.children);
}
View sendState.js
const { Provider } = ReactRedux;
window.addEventListener("message", e => {
// extentions and other 3rd party scripts talk via postMeessage api(same orgin)
// so it is very important to filter those events
if (e.origin !== window.location.origin || !e.data || e.data.source !== "dialog-message") {
return;
}
// parent and window are same thing if the current page is not in any frame
View ReactComponentWithCustomAttributes.js
// Suppose we want a div to have some custom attributes, normally react wouldn't allow custom attributes
// so this is a hack to att as much custom attributes to your component as you want
class Div extends React.Component {
componentDidMount() {
this.addAttributes();
}
componentWillReceiveProps(nextProps) {
@ar5had
ar5had / gist:5bb796b1f07fc9046ddaa10e78c152be
Created May 25, 2017 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:5bb796b1f07fc9046ddaa10e78c152be

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:
View gist:0e424e7b7f67bb4e1018e2d963a8d42f
/ WARNING
//
// Do NOT edit this file while ZNC is running!
// Use webadmin or *controlpanel instead.
//
// Altering this file by hand will forfeit all support.
//
// But if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.
// Also check http://en.znc.in/wiki/Configuration
@ar5had
ar5had / blockscope-vars-in-es5.js
Created May 12, 2017
hack for block scope variables in es5..
View blockscope-vars-in-es5.js
try {
throw 1;
} catch (myfancyvariable) {
console.log('This variable is only availabe within this catch block =>', myfancyvariable);
}
@ar5had
ar5had / JSFirst.md
Created May 11, 2017 — forked from rtoal/JSFirst.md
JSFirst
View JSFirst.md

JS First

About This Manifesto

Have you ever argued for or against teaching language X as the first language in a university computer science curriculum? If so, I hope that your arguments:

  • were first and foremost about students, not about your personal language preferences (in other words, you should answer the question “What do we want students to gain from their experience with a first language?”, not “Is language X better than language Y?” because people hate that latter question);
  • kept in mind that ultimately we want to train polyglots, so the first language is never the only language; and
  • took into account previous work from computing educators, and education theorists and practitioners in general.