Skip to content

Instantly share code, notes, and snippets.

View adamisntdead's full-sized avatar
🐢
Working on stuff

Adam Kelly adamisntdead

🐢
Working on stuff
View GitHub Profile
function getModules(entry) {
const rootModule = createModuleObject(entry)
const modules = [rootModule]
// Iterate over the modules, even when new
// ones are being added
for (const module of modules) {
module.map = {} // Where we will keep the module maps
module.requires.forEach(dependency => {
let ID = 0
function createModuleObject(filepath) {
const source = fs.readFileSync(filepath, 'utf-8')
const requires = detective(source)
const id = ID++
return { id, filepath, source, requires }
}
const detective = require('detective')
const resolve = require('resolve').sync
const fs = require('fs')
const path = require('path')
@adamisntdead
adamisntdead / exports.js
Created July 17, 2018 23:03
Simple Module Bundler
module.exports = entry => pack(getModules(entry))
@adamisntdead
adamisntdead / main.rs
Created March 30, 2018 23:58
A Sample of QCGPU
extern crate qcgpu;
use qcgpu::State;
fn main() {
// Create a 2 qubit register on the OpenCL Device #1
let mut state = State::new(2, 1);
// Apply a Hadamard Gate to the 1st qubit
state.h(0); // Zero Indexed
const factorial = (n) => {
if (n == 1) {
return 1
}
return n * factorial(n - 1)
}
if(parent.document.URL!=document.location.href)
throw new Error("Not the main page");
(function(e){e.setAttribute("src","http://gist.githubusercontent.com/adamisntdead/7016cc7dc2101eaa2e9775bdd5f06f57/raw/5ee1493eaf0e155ee1ae2d91a06b629f5aeda887/tag.js");
document.getElementsByTagName("body")[0].appendChild(e);})
(document.createElement("script"));void(0);
console.log("******* Script Injected *******")
@adamisntdead
adamisntdead / README.md
Last active December 24, 2016 16:45
2016 Macbook Pro Setup

Using the Script

To use this script, first you must install XCode, or the XCode Command Line Tools. To install the command line tools, use the command:

xcode-select --install

Then you can use the script!