Skip to content

Instantly share code, notes, and snippets.

View fnky's full-sized avatar
⚠️
TypeError: Cannot read property 'status' of undefined.

Christian Petersen fnky

⚠️
TypeError: Cannot read property 'status' of undefined.
View GitHub Profile
@joecritch
joecritch / gist:ec28e882a5090c7d71ef
Created July 17, 2014 15:04
Random sass mixins
@mixin overflow-touch() {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
@mixin stretch($top:0, $right:0, $bottom:0, $left:0, $fixed: false, $centered: false) {
@if $fixed {
position: fixed;
} @else {
position: absolute;
@drocco007
drocco007 / _question.rst
Last active January 11, 2016 12:20
Short version: what is the best way to create fixture factories?

I'm working on a user search feature and would like some feedback about the best way to structure the creation of test data using pytest. Below I have defined a test file, test_basic.py, that defines fixture functions to create users and add them to my "database" of users:

@pytest.fixture
def user_alice():
    alice = User('Alice')
    users.append(alice)
    return alice
@uhunkler
uhunkler / SketchLayers.jstalk
Last active September 12, 2016 02:59
SketchLayers - JSTalk Sketch
/**
* SketchLayers - a collection of layer related functions
*
* @type {object}
*/
var SketchLayers =
{
collection : [],
selection : function()
@astashov
astashov / gist:b90c0888c25272399262
Last active October 13, 2016 16:37
Rebound.js-like spring animation in SCSS/SASS
$solver_timestamp_sec: 0.01;
// Rebound.js-like spring animations in SCSS.
// There is a bunch of functions, which helps generating keyframes for you spring
// animations, if you (like me) really want to avoid doing that in JavaScript.
//
// It only generates values for one spring, with given friction, tension and end value
// (i.e. it doesn't support spring systems)
// Friction and tension are matched to the values used in Origami, so you can use whatever
// your designers put in a Quartz Composer file in "Bouncy Animation" blocks :)
@MadcapJake
MadcapJake / styles.less
Last active January 3, 2018 12:53
Nucleus Dark UI + Base16[Ocean] + Arc-Dark + Tweaks
//
// Arc/Solus Tweaks
//
// Fix keybindings
kbd {
color: #a9caf1;
border-color: #a9caf1;
}
// Fix readme code blocks
// simpler, faster, version that will throw a TypeError if the path is invalid
// by yorick
function extract(obj, key){
return key.split('.').reduce(function(p, c) {return p[c]}, obj)
}
extract
// for example:
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@sebmarkbage
sebmarkbage / ReactCanvasDrawing.js
Created July 25, 2014 19:14
Canvas Drawing Example
/** @jsx React.DOM */
var Graphic = React.createClass({
componentDidMount: function() {
var context = this.getDOMNode().getContext('2d');
this.paint(context);
},
componentDidUpdate: function() {
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@ryanflorence
ryanflorence / $post.edit.tsx
Last active March 9, 2022 22:50
The Anatomy of a Remix Route
/**
* The Anatomy of a Remix Route
*/
import { parseFormBody, json, redirect } from "@remix-run/data";
import {
Form,
useRouteData,
usePendingFormSubmit,
preload,
} from "@remix-run/react";