Skip to content

Instantly share code, notes, and snippets.

View amasad's full-sized avatar
🎱
balling

Amjad Masad amasad

🎱
balling
View GitHub Profile
@amasad
amasad / cssjs-to-css.el
Created October 20, 2017 22:09
css-in-js to css elisp command
(defun un-camelcase-string (s)
(let ((case-fold-search nil))
(while (string-match "[A-Z]" s 1)
(setq s (replace-match (concat "-"
(downcase (match-string 0 s)))
t nil s)))
(downcase s)))
(defun cssjs-to-css ()
(interactive)
@amasad
amasad / J28X-0.py
Created July 14, 2017 20:23
null created by amasad - https://repl.it/J28X/0
x = 1
print(x)
@amasad
amasad / repl.js
Created May 17, 2017 22:42
a project repl
const babel = require('babel-core');
const vm = require('vm');
const repl = require('repl');
let context = repl.start({ eval: evaluate }).context;
// Autorequire all models so that they're available by name in the repl.
const models = require('../server/models');
for (let name in models) {
context[name] = models[name];
@amasad
amasad / lua-repl.go
Last active January 13, 2017 07:26
A lua repl in go
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"regexp"
"strings"
"time"
@amasad
amasad / genPropTypes.js
Created January 5, 2017 20:22
Given a React component props, generate potential react propTypes
const topLevelBlacklist = [
'children',
'history',
'location',
'params',
'route',
'routeParams',
'routes',
];
@amasad
amasad / DxrZ-1.py
Created October 17, 2016 09:28
null created by amasad - https://repl.it/DxrZ/1
fdsafdsafdsafds
@amasad
amasad / index.js
Created August 17, 2016 01:11
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var Buffer = require("buffer").Buffer
b = new Buffer(100)
document.write(b.subarray(50, 100).length);
@amasad
amasad / test.react.js
Created June 9, 2016 02:09
inline inline styles
class Test extends React.Component {
render() {
return <div style={Style.div}/>;
}
}
var Style = {
div: {
background: 'red'
}
document.write('<link rel="stylesheet" href="https://assets-cdn.github.com/assets/gist/embed-e75a8866f2a8f51e8bbbf8ca746676f1e7cacb08f4b1d9b52ea62524b333cc6d.css">')
document.write('<div id=\"gist28246440\" class=\"gist\">\n <div class=\"gist-file\">\n <div class=\"gist-data\">\n <div class=\"js-gist-file-update-container js-task-list-container file-box\">\n <div id=\"file-clowtown\" class=\"file\">\n \n\n <div class=\"blob-wrapper data type-text\">\n <table class=\"highlight tab-size js-file-line-container\" data-tab-size=\"8\">\n <tr>\n <td id=\"file-clowtown-L1\" class=\"blob-num js-line-number\" data-line-number=\"1\"><\/td>\n <td id=\"file-clowtown-LC1\" class=\"blob-code blob-code-inner js-file-line\">clowntown<\/td>\n <\/tr>\n<\/table>\n\n <\/div>\n\n <\/div>\n \n<\/div>\n\n <\/div>\n <div class=\"gist-meta\">\n <a href=\"https://gist.github.com/amasad/dbbfee7b9aa8dfb55bd4/raw/e6503803eedad49fe9bb0490a4ff6f1c81060947/clowtown\" style=
@amasad
amasad / babel-heap-test.js
Last active August 29, 2015 14:26
Not reclaiming unused heap
console.log('pid', process.pid);
var babel = require('babel-core');
var bigFile = require('fs').readFileSync(
require.resolve('babel-core/browser'),
'utf8'
);
babel.transform(bigFile);
console.log('before gc');