Skip to content

Instantly share code, notes, and snippets.

View ar5had's full-sized avatar
🎯
Focusing

Arshad Khan ar5had

🎯
Focusing
View GitHub Profile
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@ar5had
ar5had / JSFirst.md
Created May 11, 2017 15:51 — forked from rtoal/JSFirst.md
JSFirst

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.
@ar5had
ar5had / blockscope-vars-in-es5.js
Created May 12, 2017 15:40
hack for block scope variables in es5..
try {
throw 1;
} catch (myfancyvariable) {
console.log('This variable is only availabe within this catch block =>', myfancyvariable);
}
/ 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
// 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) {
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
@ar5had
ar5had / ReactIgnore
Created July 25, 2017 14:45 — forked from alexeisavca/ReactIgnore
A simple component to make ReactJs ignore subtrees
var React = require('react/addons');
var ReactIgnore = {
displayName: 'ReactIgnore',
shouldComponentUpdate (){
return false;
},
render (){
return React.Children.only(this.props.children);
}
// #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 / css-boilerplate.css
Created September 2, 2017 14:46
CSS boilerplate
: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;
@ar5had
ar5had / Local PR test and merge.md
Created October 29, 2017 15:47 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

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: Psiphon-Labs/psiphon-tunnel-core#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