Skip to content

Instantly share code, notes, and snippets.

Avatar

James Kraus jameskraus

View GitHub Profile
@jameskraus
jameskraus / flow-override.js
Created May 12, 2017
Override default flow definition
View flow-override.js
// @flow
declare class Date {
constructor(): void;
constructor(timestamp: number): void;
constructor(dateString: string): void;
constructor(year: number, month: number, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number): void;
getDate(): number;
getDay(): number;
getYear(): number;
View flow-hoc-type.js
// @flow
import React from 'react'
import ReactDom from 'react-dom'
class InnerComponent extends React.Component<void, { myVal: number }, void>{
props: { myVal: number }
render = () =>
<div>
@jameskraus
jameskraus / composer-update-with-test.sh
Last active Mar 10, 2017
Update Composer Dependencies and Run Tests After Each Dependency
View composer-update-with-test.sh
grep '".*": ".*"' composer.json |
sed -E 's/[ \t]+//' |
sed -E 's/"[^\/]+": ".*",?//' |
sed '/.*\\.*/d' | sed -E '/^\s*$/d' |
sed -E 's/: ".*",?//' | sed -E 's/"//g' |
awk '{ print "composer update " $1 " && yarn test || exit 255""\0" }' |
xargs -n 1 -0 bash -c
@jameskraus
jameskraus / ImportGroups.php
Created Feb 9, 2017
Modified Adldap2-Larvel Command
View ImportGroups.php
<?php
namespace App\Console\Commands;
use Adldap\Models\Entry;
use Adldap\Models\Group;
use Illuminate\Console\Command;
class ImportGroups extends Command
{
@jameskraus
jameskraus / Zoom.py
Created Feb 21, 2016
Zoom extension for Anki
View Zoom.py
# -*- mode: Python ; coding: utf-8 -*-
# Copyright © 2012–2013 Roland Sieker <ospalh@gmail.com>
# Based in part on code by Damien Elmes <anki@ichi2.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
"""Add-on for Anki 2 to zoom in or out."""
from PyQt4.QtCore import Qt, SIGNAL
from PyQt4.QtGui import QAction, QKeySequence, QMenu