Skip to content

Instantly share code, notes, and snippets.

@mottaquikarim
mottaquikarim / public-sta9760-grade-results.ipynb
Created April 26, 2020 17:54
Public STA9760 Grade Results.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mottaquikarim
mottaquikarim / README.md
Last active December 14, 2017 20:31
GET all scripts from webscript.io

Dump WebScript Scripts

  1. Download the py file above, save as dump_webscript.py
  2. Go to https://www.webscript.io/settings and copy APIKEY
  3. Replace user (line 10) with your Webscript login email
  4. Replace api_key (line 11) with APIKEY
  5. Activate venv: virtualenv .venv && source .venv/bin/activate
  6. pip install requests
  7. python dump_webscript.py
@mottaquikarim
mottaquikarim / dispatcher.js
Created June 23, 2017 14:42 — forked from whyu/dispatcher.js
Wrap flux dispatcher
function wrapFlux(MainApp, availableActions, defaultStore) {
return React.createClass({
getInitialState: function() {
return $.extend({}, defaultStore, this.props.additionalData);
},
dispatcher: function(action, extras) {
// if an array of actions is passed in
if (Array.isArray(action)) {
var promiseArr = []; // Create Promise Array
@mottaquikarim
mottaquikarim / GMaps.js
Created June 11, 2017 15:32
GMaps React Component
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
const generateRandomFunc = (functionRoot, cb = function(){}) => {
const functionName = `${functionRoot}_${Date.now()}`;
window[functionName] = (overrideCb = null) => {
delete window[functionName];
if (overrideCb) {
overrideCb();
return;
@mottaquikarim
mottaquikarim / app.js
Created April 23, 2017 07:33
firebase storage / completed example with refactored code
(() => { // protect the lemmings!
const validate = () => {
throw new Error('This is a required arg');
}; // validate
const uploadFiles = (
fileSelectSel = validate(),
fileElemSel = validate(),
onFileChanged = validate()
) => {
@mottaquikarim
mottaquikarim / index.html
Created April 23, 2017 07:05
firebase storage / with upload of file to Firebase Storage itself
<!DOCTYPE html>
<html>
<head></head>
<body>
<input type="file" class="js-fileElem" multiple accept="image/*" style="display:none">
<a href="#" class="js-fileSelect">Select some files</a>
<script src="https://www.gstatic.com/firebasejs/3.8.0/firebase.js"></script>
@mottaquikarim
mottaquikarim / index.html
Created April 23, 2017 06:52
firebase storage / with file upload
<!DOCTYPE html>
<html>
<head></head>
<body>
<!-- ADDED THESE LINES -->
<input type="file" class="js-fileElem" multiple accept="image/*" style="display:none">
<a href="#" class="js-fileSelect">Select some files</a>
<!-- END ADDED THESE LINES -->
@mottaquikarim
mottaquikarim / index.html
Created April 23, 2017 06:02
firebase storage / with storage ref creation
<!DOCTYPE html>
<html>
<head></head>
<body>
<script src="https://www.gstatic.com/firebasejs/3.8.0/firebase.js"></script>
<script>
(() => { // protect the lemmings!
// Initialize Firebase
const config = {
@mottaquikarim
mottaquikarim / index.html
Last active April 23, 2017 05:58
firebase storage example
<!DOCTYPE html>
<html>
<head></head>
<body>
<script src="https://www.gstatic.com/firebasejs/3.8.0/firebase.js"></script>
<script>
(() => { // protect the lemmings!
// Initialize Firebase
const config = {
@mottaquikarim
mottaquikarim / 0_reuse_code.js
Created February 22, 2017 15:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console