Skip to content

Instantly share code, notes, and snippets.

View bresson's full-sized avatar

Bresson bresson

  • New York, NY
View GitHub Profile
@bresson
bresson / gist:3714428
Created September 13, 2012 13:51 — forked from aarongrando/gist:1635158
jQuery UI Autocomplete Facebook Friends
$(function() {
// Depends on: jQuery, jQuery UI core & widgets (for the autocomplete method)
// Assumes you're already including the FB JS SDK asynchronously...
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxxxxxxxxxxxxx', // App ID
status : true, // check login status
// Function for returning the user to any 'y' position in a Facebook app/tab. Uses jQuery animate, otherwise gracefully falls-back without it.
// Source[1]: http://stackoverflow.com/questions/7193425/how-do-you-animate-fb-canvas-scrollto
// Source[2]: https://developers.facebook.com/docs/reference/javascript/FB.Canvas.scrollTo/
var scrollY = function (y) {
if (window.jQuery) {
FB.Canvas.getPageInfo (function (pageInfo) {
$({ y: pageInfo.scrollTop })
.animate({
y: y
@bresson
bresson / jsbin.ezEgimA.html
Created December 31, 2013 02:19
Javascript right to left string reversal
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
@bresson
bresson / 0_reuse_code.js
Created January 10, 2014 15:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!doctype html>
<html>
<head>
<style>
div:after {
content:"\2605";
color: black;
}
</style>
</head>
@bresson
bresson / index.html
Created October 8, 2014 04:38
[add your bin description] // source http://jsbin.com/huwog/21
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.container {
border: 1px solid #CCC;
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
@bresson
bresson / webpack_c9.sh
Created February 17, 2016 01:22 — forked from kdabir/webpack_c9.sh
Running webpack on c9.io
webpack-dev-server --progress --colors --host $IP --port $PORT
@bresson
bresson / scrollTo.js
Created March 14, 2016 07:06 — forked from james2doyle/scrollTo.js
a native scrollTo function in javascript that uses requestAnimationFrame and easing for animation
// easing functions http://goo.gl/5HLl8
Math.easeInOutQuad = function (t, b, c, d) {
t /= d/2;
if (t < 1) {
return c/2*t*t + b
}
t--;
return -c/2 * (t*(t-2) - 1) + b;
};
@bresson
bresson / functional composition
Last active December 24, 2016 01:59
Javascript experiment with functional composition allowing arbitrary number of composed functions through ES6, closure and tail recursion.
// experiment of functional composition
const addOne = a => a + 1;
const double = a => a * 2;
const square = a => a * a;
const lCompose = (...args) => {
const _lCompose = ( acc, ...args ) => {