Skip to content

Instantly share code, notes, and snippets.

View legodude17's full-sized avatar
🙃
Failing at code

Joshua legodude17

🙃
Failing at code
View GitHub Profile
@legodude17
legodude17 / bookmarklets.html
Last active November 15, 2016 19:42
A set of bookmarklets
<div class='container'>
Bookmarklets:
Simply click and drag the link to your bookmarks bar.
<ul class='list'>
<li><a href="javascript:document.body.contentEditable='true'; document.designMode='on'; void 0">Edit</a></li>
<li><a href="javascript:document.body.contentEditable='false'; document.designMode='off'; void 0">Unedit</a></li>
<li><a href="javascript:(function(){var a = prompt('What file?');var b=document.createElement('script');b.src=a;document.body.appendChild(b);}())">Add scripts</a></li>
<li><a href="javascript:(function () {
function getSelectionText() {
var text = '';
@legodude17
legodude17 / fetch.js
Created July 28, 2016 03:07
A setup for just fetching a package and unpacking.
var request = require('request');
var targz = require('tar.gz');
var semver = require('semver');
var JSONStream = require('JSONStream');
var concat = require('concat-stream');
var file = process.argv[2];
var dir = process.argv[3] || process.cwd();
function fetchUnpack(url, dir) {
request(url).pipe(targz().createWriteStream(dir));
}
@legodude17
legodude17 / events-test.js
Created July 30, 2016 23:34
A file for testing the events of the promise library native-promise-only.
var path = require('path');
var Promise = require(path.join(__dirname,"lib","npo.src.js"));
var unHandled = [];
var count = {
handled: 0,
unhandled: 0
};
process.on('rejectionHandled', function (promise) {
var index = unHandled.indexOf(promise);
unHandled.splice(index, 1);
@legodude17
legodude17 / fetch.js
Last active August 30, 2016 17:02
A setup for fetching a package and unpacking it.
"use strict";
var tar = require('tar');
var zlib = require('zlib');
var semver = require('semver');
var RegClient = require('npm-registry-client');
var client = new RegClient();
function latestVersion(list) {
return list.reduce(function (biggest, cur) {
if (semver.gt(cur, biggest)) {
return cur;
@legodude17
legodude17 / result.txt
Created August 22, 2016 17:20
Output of time npm ls -g
/home/jdb/.npm-packages/lib
├─┬ babel-cli@6.11.4
│ ├─┬ babel-core@6.13.2
│ │ ├─┬ babel-code-frame@6.11.0
│ │ │ ├── esutils@2.0.2
│ │ │ └── js-tokens@2.0.0
│ │ ├─┬ babel-generator@6.11.4
│ │ │ └─┬ detect-indent@3.0.1
│ │ │ ├── get-stdin@4.0.1
│ │ │ └─┬ repeating@1.1.3
> pcm-utils@0.0.1 install /home/jdb/Desktop/Code/audio-test/node_modules/pcm-utils
> node-gyp rebuild
make: Entering directory '/home/jdb/Desktop/Code/audio-test/node_modules/pcm-utils/build'
CXX(target) Release/obj.target/binding/binding.o
In file included from ../binding.cc:2:0:
../mixer.h:17:33: error: expected class-name before ‘{’ token
class Mixer : public ObjectWrap {
^
../mixer.h:39:5: error: ‘uv_work_t’ does not name a type
@legodude17
legodude17 / troubleshoot.md
Last active December 15, 2016 21:23
My trouble shooting guide for npm

Troubleshooting Guide

My troubleshooting guide for npm. I use it to help people with their issues on the npm issue tracker.

Follow the arrows:

  1. What is the error?
  • shasum check failed -> File an issue with npm/registry
  • Error parsing json -> 2
  • Missing script -> Make sure you have a start script in package.json
@legodude17
legodude17 / animate.html
Last active March 16, 2017 18:25
A demo of using GSAP to animate for material design, but bad.
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenLite.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/plugins/CSSPlugin.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/easing/EasePack.min.js"></script>
<style>
.float {
border: 0;
border-radius: 24px;
width: 48px;
height: 48px;
background-color: red;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Peer Chat</title>
<style media="screen">
body {
width: 100%;
height: 100%;
}
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',