Skip to content

Instantly share code, notes, and snippets.

// Simplest possible wrapper around IHKeyboardAvoiding.
//
// I don't really know how to Xcode, but I got it to work by:
//
// 1. Checking out the IHKeyboardAvoiding repository.
// https://github.com/IdleHandsApps/IHKeyboardAvoiding
//
// 2. Dragging the Files IHKeyboardAvoiding.{h,m} into my project.
//
// 3. Ensuring that both .m files are in the "Compile Sources" phase of the target.
@idibidiart
idibidiart / RCTSwiftBridgeModule.h
Created October 20, 2015 16:23 — forked from robertjpayne/RCTSwiftBridgeModule.h
React Native - Swift Native Modules
#import <Foundation/Foundation.h>
#import "RCTBridgeModule.h"
#define RCT_EXTERN_MODULE(objc_name, objc_supername) \
RCT_EXTERN_REMAP_MODULE(objc_name, objc_name, objc_supername)
#define RCT_EXTERN_REMAP_MODULE(js_name, objc_name, objc_supername) \
objc_name : objc_supername \
@end \
@interface objc_name (RCTExternModule) <RCTBridgeModule> \
@idibidiart
idibidiart / React Native: Animated - Code
Created September 22, 2015 14:17 — forked from sahrens/React Native: Animated - Code
Example code from ReactEurope 2015 talk - React Native: Animated
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@idibidiart
idibidiart / index.ios.js
Last active September 1, 2015 00:39 — forked from ide/index.ios.js
Redux batching example with React Native
/**
* Batched updates test with Redux. You will need React 0.6.0 and a .babelrc:
{
"whitelist": [
"es6.parameters.default",
"es7.decorators"
]
}
*/
'use strict';
@idibidiart
idibidiart / README.md
Last active August 29, 2015 14:14 — forked from mgold/README.md

This is a fork of Mike Bostock's Multi-Series Line Chart, which adds circles along the line for each data point. The circles help anchor us to the real datapoints (rather than extrapolations) when comparing across lines.

But this is really an exercise in nested selections, leveraging selections as groups. The data consists of multiple lines, which each have multiple data points. We call .data twice: first with the data for all cities, binding the array for each city as a single datum. This is good enough for D3's line generators but not for placing circles. So we selectAll circles from the merged enter-update selection, and then bind the data for each line using a function, which is passed each datum from the prior join. This step produces a new data join, and you need to do it even if the function you pass is the identity. Since there are no circles, we skip straight to the enter selection and append them. Then we assign them x and y positions based on the accessor

Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@idibidiart
idibidiart / README.md
Last active December 21, 2015 15:09 — forked from mbostock/.block

For best viewing experience, please play “Doin’ It Right (feat. Panda Bear)” off the latest Daft Punk album while watching this animation.

const PHANTOM_FUNCTION_PREFIX = '/* PHANTOM_FUNCTION */';
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
if (msg.indexOf(PHANTOM_FUNCTION_PREFIX) === 0) {
eval('(' + msg + ')()');
} else {
console.log(msg);
}
# For each day, find the appropriate Poisson Parameter and use it to calculate the likelihood of the actual view count
# Likelihood = P(D|H)
Calc.Likelihood <- function(changes, poissons, stats, periods) {
likelihood <- 0
for (day in 1:nrow(stats)) {
proceed <- FALSE
period <- 1
while (!proceed) {
if (day < changes[period]) {