Skip to content

Instantly share code, notes, and snippets.

View fdidron's full-sized avatar

Florian Didron fdidron

View GitHub Profile
@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(
chat: {
  unread: n,
  messages : [
    {
      from: userId,
      to: userId,
      timestamp: timestamp,
      unread: true
 }
@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) {
@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
import React from 'react';
// Scaffold imports
import './{{name}}.less';
{{imports}}
// End scaffold imports
class {{name}} extends React.Component {
constructor(props) {
@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 = {
@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 / document.body.style.json
Created October 22, 2016 05:20
document.body.style object export Chrome OS X v53.0.2785.143 (64-bit)
{
"alignContent": "",
"alignItems": "",
"alignSelf": "",
"alignmentBaseline": "",
"all": "",
"animation": "",
"animationDelay": "",
"animationDirection": "",
"animationDuration": "",
@fdidron
fdidron / error.trace
Created January 12, 2017 00:44
Hyper Aur Yarn error Log
Installing app dependencies for arch x64 to /tmp/yaourt-tmp-florian/aur-hyper/src/hyper-1.1.0/app
Error: /usr/bin/node exited with code 1
Output:
yarn install v0.18.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error output:
error https://github.com/Tyriar/pty.js/tarball/c75c2dcb6dcad83b0cb3ef2ae42d0448fb912642: Bad hash. Expected "a6ae3472bd63d7a5c489699fa7b50de160d97bd5" but got "78b09a52820f7306dc809343f0160b6e6b0592c5"
@fdidron
fdidron / App.js
Last active April 11, 2023 13:54
React Router v4 Auth
//Usage
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import Route from './AuthRoute';
import Login from './Login';
import Private from './Private';
export default () =>
<Router>