Skip to content

Instantly share code, notes, and snippets.

View bsansouci's full-sized avatar

Benjamin San Souci bsansouci

View GitHub Profile
@bsansouci
bsansouci / Loop-react-motion.js
Last active March 21, 2017 09:09
Example Loop component React-Motion
let Loop = React.createClass({
getInitialState() {
return {
isMovingToEnd: true
};
},
endValue(currVals) {
let {endValueProp, isDone, startValue} = this.props;
let {isMovingToEnd} = this.state;
@bsansouci
bsansouci / react-motion-transition-example.js
Created July 13, 2015 18:58
Example of how to have two animations back to back
import React, {Component} from 'react';
import {TransitionSpring} from '../Spring';
import {clone} from '../utils';
const defaultTickAmount = 100;
const constConfig = [120, 10];
class Demo extends Component {
state = {
someData: ["a", "b", "c", "d"]
var request = require("request");
var async = require("async");
var fs = require("fs");
function searchFor(searchQuery, pageNum, callback) {
for(var i = 0; i < pageNum; i++) {
(function(i) {
request.get("https://www.google.fr/search?q=" + searchQuery + "&start=" + i * 10, function(err, res) {
if(err) throw err;
/*eslint-disable */
import React from 'react';
import {TransitionSpring} from '../../src/Spring';
// debugging on mobile <3
// console.log = function(...args){
// let div = document.createElement('div');
// div.textContent = JSON.stringify(args.join(' '));
// let parent = document.querySelector('#content');
/*eslint-disable */
import React, {PropTypes} from 'react';
import {TransitionSpring} from '../src/Spring';
const Demo = React.createClass({
getInitialState() {
return { open: false };
},
@bsansouci
bsansouci / Google-query.js
Created July 18, 2015 01:36
Use searchTerms.txt to query first couple pages of Google. Will pop up with a captcha when needed.
var request = require("request");
var exec = require('child_process').exec;
var jar = request.jar();
request = request.defaults({jar:jar});
var async = require("async");
var cheerio = require("cheerio");
var fs = require("fs");
var readline = require('readline');
@bsansouci
bsansouci / Demo.jsx
Created July 18, 2015 21:26
Working with CSS Transitions in react-motion
/*eslint-disable */
import React, {cloneElement} from 'react';
import {TransitionSpring} from '../../src/Spring';
var Counter = React.createClass({
render: function() {
return <div className={this.props.className} style={{
width: 100, height: 100,
backgroundColor: 'hsl(' + Math.ceil(Math.random() * 360) + ', 100%, 50%)',
import React from 'react';
import {Spring} from '../../src/Spring';
const OnMount = React.createClass({
getInitialState() {
return {
render: true
};
},
@bsansouci
bsansouci / object-syntax-proposal.rs
Last active November 27, 2016 17:36
Object syntax proposal.
/**
* Object syntax proposal.
*
* Look at Jordan's named arguments proposal to understand the named args
* syntax used here:
* https://gist.github.com/jordwalke/119fb44b95fdf7d703041f8ac54b5b4e
*
* This is building on top of the ideas here:
* https://github.com/facebook/reason/pull/767
*
/*
* vim: set ft=rust:
* vim: set ft=reason:
*/
/* This is pretty cool because it allows us to keep track of what the previous .thenDo returned.
Look at the one below which makes the code look a bit closer to JS.
*/
type promiseT 'a;