Skip to content

Instantly share code, notes, and snippets.

@marcins
marcins / file.js
Created February 2, 2018 06:46
Flow typing for passing Unstated Container as props?
// @flow
import React from "react";
import { render } from "react-dom";
import { Provider, Subscribe, Container } from "unstated";
type CounterState = {
count: number
};
class CounterContainer extends Container<CounterState> {
@marcins
marcins / Connect.js
Last active February 2, 2018 06:27
Unstated "Connect"
// @flow
import * as React from "react";
import { Subscribe, type ContainerType, type ContainersType } from "unstated";
type ContainerMapping = { [key: string]: ContainerType };
type ConnectTo = ContainerMapping[];
const Connect = ({
component,
to,
@marcins
marcins / keybase.md
Created June 29, 2016 00:30
keybase.md

Keybase proof

I hereby claim:

  • I am marcins on github.
  • I am marcins (https://keybase.io/marcins) on keybase.
  • I have a public key whose fingerprint is A73A 36D4 1CC0 99D8 34DB 1A0A 42CE 9421 306F B05F

To claim this, I am signing this object:

@marcins
marcins / test.cfm
Created January 31, 2014 04:27
UTF-8 variable name
<cfprocessingdirective pageEncoding="utf-8">
<cfset € = "Hi!">
<cfoutput>#€#</cfoutput>
<cfscript>
testNumbers = [
"0", "0.0", "0.00", "0.000", "0.001",
"0.1", "0.10", "0.100", "0.101",
"0.11", "0.110", "0.111"
];
expectedNumbers = [
"0", "0", "0", "0", "0",
"0.1", "0.1", "0.1", "0.1",
@marcins
marcins / frameworkRouteMethodSpecificTest.cfc
Created October 18, 2012 08:25
Testing using a different HTTP method
component extends="mxunit.framework.TestCase"
{
public void function setUp() {
variables.fw = new org.corfield.framework();
makePublic(variables.fw, "processRouteMatch");
}
public void function testRouteMatchMethod()
{
debug("Testing for method #CGI.REQUEST_METHOD#");
@marcins
marcins / get-sprite.scss
Created August 1, 2012 05:21 — forked from dfadler/get-sprite.sass
An SCSS mixin for generating a sprite declaration block that will work with media queries
@mixin get-sprite($map, $sprite, $repeat: no-repeat, $height: true, $width: true)
{
//http://compass-style.org/reference/compass/helpers/sprites/#sprite-file
$sprite-image: sprite-file($map, $sprite) ;
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-url
$sprite-map: sprite-url($map);
// http://compass-style.org/reference/compass/helpers/sprites/#sprite-position
$sprite-position: sprite-position($map, $sprite);
@marcins
marcins / bookmarklet.js
Created February 2, 2012 04:44
Quick and Dirty Bookmarlet for adding Facebook App to Page
javascript:var els = document.getElementsByClassName("fcb");window.open("https://www.facebook.com/dialog/pagetab?app_id=" + els[0].innerHTML + "&next=" + els[2].innerHTML);e.preventDefault();
@marcins
marcins / gist:1057937
Created July 1, 2011 05:45
Passing closure vs function test
function wrap()
{
var a = 5;
var testClosure = function testClosure()
{
console.log(a);
}
func(function() { console.log(a) });
func(testClosure);