Skip to content

Instantly share code, notes, and snippets.

Kalley Powell kalley

  • Get More Math
  • Houston, TX
Block or report user

Report or block kalley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kalley
kalley / styled-components.js.flow
Last active Sep 27, 2017
styled-components libdef that actually checks props and defaultProps
View styled-components.js.flow
// @flow
type $npm$styledComponents$ComponentWithDefaultProps<
DefaultProps: {},
Props: {}
> = React$ComponentType<Props> & { defaultProps: DefaultProps }
type $npm$styledComponents$Interpolation =
| (<C: {}>(executionContext: C) => $npm$styledComponents$Interpolation)
| string
View keybase.md

Keybase proof

I hereby claim:

  • I am kalley on github.
  • I am kalley (https://keybase.io/kalley) on keybase.
  • I have a public key ASAaiqievDn32ALvFULMGmDK18blZEjaN0dedGNRDvPX_Ao

To claim this, I am signing this object:

@kalley
kalley / Garmin.php
Created Sep 24, 2014
Garmin server for use with https://github.com/thephpleague/oauth1-client. Garmin doesn't have any public endpoints outside of authorization, so this takes that into account.
View Garmin.php
<?php
use League\OAuth1\Client\Server\Server;
use League\OAuth1\Client\Credentials\CredentialsInterface;
use League\OAuth1\Client\Credentials\TokenCredentials;
use League\OAuth1\Client\Credentials\TemporaryCredentials;
use League\OAuth1\Client\Credentials\CredentialsException;
use League\OAuth1\Client\Server\User;
use Guzzle\Http\Exception\BadResponseException;
@kalley
kalley / REAMDE.md
Last active Aug 29, 2015
rem units less mixin
View REAMDE.md

This assumes your base font variable is @base-font-size. Change accordingly.

This does not work with borders or shadows yet.

You can use this to do any of the following operations:

#logo {
  .rem(font-size, 40px);
  .rem(margin, 20px 10px);
  .rem(padding, 20px 20px 10px 15px);
@kalley
kalley / canvas.js
Created Feb 7, 2014
Simple wrapper around canvas
View canvas.js
var Canvas = (function() {
var Canvas = function(id, width, height) {
this.el = id.nodeName ? id : document.getElementById(id);
this.context = this.el.getContext('2d');
this._events = {};
if ( width || height ) this.size(width, height);
},
proto = Canvas.prototype,
started = false,
extendProto = function(p, obj) {
View jquery.cssCapture.js
(function($) {
var head = $('head');
$.cssCapture = function(selectors, manipulate) {
var stylesheets = document.styleSheets,
selectors = selectors.split(/\s*,\s*/),m
promises = [],
matched = [],
View marionette.views.events.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Marionette Render Process</title>
<style>
body, select {
font-family: sans-serif;
}
ul {
View modernizr.shaw.js
Modernizr.testStyles('#modernizr { height: 50px; width: 50px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; display: table; }', function(elem, rule) {
Modernizr.addTest('shaw', Math.round(window.innerHeight / 2 - 25) === elem.offsetTop);
});
@kalley
kalley / color.js
Last active Dec 20, 2015
Small class to create colors, output different formats (hex, rgb(a), hsl(a)), or interpolate between colors, for animation or just to mix them.
View color.js
/*
* How to use
*
* var red = new Color('#f00');
* var green = new Color(0, 255, 0);
* var blue = new Color('rgb(0,0,255)');
* var yellow = new Color('hsla(60,100%,50%,.5)');
* var purple = new Color();
* purple.extend(Color.parse('800080'));
*
View jquery.cloneonce.js
(function($, name) {
var $clone = $.fn.clone;
$.fn[name] = function() {
return this.map(function() {
var $this = $(this),
clone = $this.data('clone');
if ( ! clone ) {
// Setting data('clone') on clone so it can't be cloned
clone = $clone.call($this).data('clone', true);
$this.data('clone', clone);
You can’t perform that action at this time.