Skip to content

Instantly share code, notes, and snippets.

View deoxxa's full-sized avatar

Conrad Pankoff deoxxa

View GitHub Profile
#!/usr/bin/env node
var babylon = require('babylon');
var fs = require('fs');
function isObject(e) {
return typeof e === 'object' && e !== null;
}
function match(h, n) {
--[[
Youtube playlist importer for VLC media player 1.1 and 2.0
Copyright 2012 Guillaume Le Maout
Authors: Guillaume Le Maout
Contact: http://addons.videolan.org/messages/?action=newmessage&username=exebetche
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
export default function(file, api) {
const j = api.jscodeshift;
const f = j(file.source);
f.find(j.ClassDeclaration).forEach((c) => {
j(c).find(j.ClassProperty, {
value: { type: 'ArrowFunctionExpression' },
}).forEach((cp) => {
let canReplace = true;
const order = [
/^lib\//,
/^actions\//,
/^reducers\//,
/^constants\//,
/^containers\//,
/^components\//,
/^schema\/[A-Z]/,
/^schema\//,
/^\.\.?\/[A-Z]/,
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
export function logComponentUpdate(WrappedComponent) {
return class Wrapped extends WrappedComponent {
static displayName = `logComponentUpdate(${getDisplayName(WrappedComponent)})`;
static WrappedComponent = WrappedComponent;
shouldComponentUpdate(nextProps, nextState) {
@deoxxa
deoxxa / example.jsx
Last active August 29, 2015 14:19
mega react views
import React from 'react';
import { Link } from 'react-router';
import { MegaRouteHandler } from '../src';
import { schema } from './api';
export class Layout extends React.Component {
render() {
return <div>
<Header />
import React from 'react';
import Router from 'react-router';
const { Route, DefaultRoute, RouteHandler, Link } = Router;
import MegaClient from '../mega-js';
const makePropTypes = function(schema) {
switch (schema.type) {
case 'string':
return React.PropTypes.string.isRequired;
@deoxxa
deoxxa / -
Created April 10, 2015 15:03
tracker | success | c
-----------------------------------------------------------------------------------------+---------+-------
http://open.nyaatorrents.info:6544/announce | t | 7214
http://exodus.desync.com/announce | t | 6392
http://torrent.ubuntu.com:6969/announce | t | 68
http://pubt.net:2710/announce | t | 51
http://tracker.anime-index.org:6969/announce | t | 17
http://3.ehtracker.org/756078/announce | t | 17
http://f.ehtracker.org/792955/announce | t | 17
http://tracker.frozen-layer.net:6969/announce
@deoxxa
deoxxa / nullstring.go
Created February 24, 2015 06:50
null string
type NullString struct {
Valid bool
Value string
}
func (n NullString) MarshalJSON() ([]byte, error) {
if n.Valid == false {
return []byte("null"), nil
} else if d, err := json.Marshal(n.Value); err != nil {
return nil, stackerr.Wrap(err)
@deoxxa
deoxxa / person-list_test.jsx
Created January 28, 2015 21:54
a react test
/** @jsx React.DOM */
var assert = require('chai').assert;
var React = require('react/addons');
var TestUtils = React.addons.TestUtils;
var PersonList = require('./person-list.jsx');
describe('PersonList', function() {