Skip to content

Instantly share code, notes, and snippets.

View fdidron's full-sized avatar

Florian Didron fdidron

View GitHub Profile
@fdidron
fdidron / reactfire.js
Last active November 28, 2017 14:24
ReactFire ES6 HOC proposal
import React from 'react';
/*************/
/* HELPERS */
/*************/
/**
* Returns the key of a Firebase snapshot across SDK versions.
*
* @param {DataSnapshot} snapshot A Firebase snapshot.
* @return {string|null} key The Firebase snapshot's key.
@fdidron
fdidron / app.jsx
Last active June 2, 2016 09:48
Fireabse - react Basic Auth
import React from 'react';
import { Auth, DatabaseRef } from 'firebaseConfig.js';
import PublicComponent from 'PublicComponent.jsx';
import PrivateComponent from 'PrivateComponent.jsx';
import LoadingComponent from 'LoadingComponent.jsx';
class App extends React.Component {
constructor() {
this.state = {
import React from 'react';
// Scaffold imports
import './{{name}}.less';
{{imports}}
// End scaffold imports
class {{name}} extends React.Component {
constructor(props) {
@fdidron
fdidron / Request
Created March 5, 2016 23:43
Cloudinary upload request
Request URL:https://api.cloudinary.com/v1_1/[Cloud Id]/image/upload/
Request Method:POST
Status Code:200 OK
Remote Address:54.210.11.115:443
Response Headers
view source
Access-Control-Allow-Methods:POST, GET, OPTIONS
Access-Control-Allow-Origin:http://localhost:8080
Access-Control-Max-Age:1728000
Cache-Control:max-age=0, private, must-revalidate
@fdidron
fdidron / Fileupload.js
Created March 5, 2016 23:15
File upload example in cloudinary
import Firebase from 'firebase';
import React from 'react';
import Config from '../../config/config';
import Uploader from '../edit/Uploader';
import { Status } from 'uxcore-uploadcore';
import Safename from 'sanitize-filename';
class FileUploader extends React.Component {
constructor(props) {
chat: {
  unread: n,
  messages : [
    {
      from: userId,
      to: userId,
      timestamp: timestamp,
      unread: true
 }
@fdidron
fdidron / vanilla-preloader
Last active August 29, 2015 14:04
Removing JQuery's dependency from the preloading image with promises code described here : http://www.bennadel.com/blog/2597-preloading-images-in-angularjs-with-promises.htm
loadImageLocation: function loadImageLocation(imageLocation) {
var preloader = this;
var _onLoadHandler = function(event) {
// Since the load event is asynchronous, we have to
// tell AngularJS that something changed.
$rootScope.$apply(