Skip to content

Instantly share code, notes, and snippets.

View azaharakis's full-sized avatar

Alexander Zaharakis azaharakis

View GitHub Profile
@azaharakis
azaharakis / results.html
Created March 9, 2017 00:53
Results with hydration data
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<link rel="stylesheet" href="/public/styles.css">
</head>
<body>
<div id="wrapper">
<div data-reactroot="" data-reactid="1" data-react-checksum="1210232727"><!-- react-empty: 2 -->
<div data-reactid="3"><a href="/" data-reactid="4"> Back to Home page </a>
@azaharakis
azaharakis / results.html
Last active July 2, 2017 23:12
Results without hydration data
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<link rel="stylesheet" href="/public/styles.css">
</head>
<body>
<div id="wrapper">
<div data-reactroot="" data-reactid="1" data-react-checksum="1210232727"><!-- react-empty: 2 -->
<div data-reactid="3"><a href="/" data-reactid="4"> Back to Home page </a>
@azaharakis
azaharakis / App.jsx
Last active July 2, 2017 23:12
Application using React
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import ComponentTreeWithData from './somme-other-component/foo/bar';
class App extends component {
state = {
loading: true,
data: null
}
constructor(props) {
const maybe = (fn) =>
function (...args) {
if (args.length === 0) {
return
}
else {
for (let arg of args) {
if (arg == null) return;
}
return fn.apply(this, args)
@azaharakis
azaharakis / listings.json
Last active September 8, 2015 13:56
sample results set with saved properties
{
"results": [{
"price": "$726,500",
"agency": {
"brandingColors": {
"primary": "#ffe51"
},
"logo": "http://i1.au.reastatic.net/agencylogo/XRWXMT/12/20120927204448.gif"
},
var rewire = require('rewire');
var search = rewire('../../../../src/js/api/search');
var when = require('when');
var promise = when.promise(function(resolve){
resolve({entity:"foo"});
});
search.__set__("client",jasmine.createSpy('spy').and.callFake(
function(){
return promise;
}
@azaharakis
azaharakis / TestContext.js
Last active August 29, 2015 14:15
Trying to stub a Subcomponent react router
'use strict';
var Router = require('react-router'),
Route = Router.Route,
React = require('react/addons'),
TestUtils = React.addons.TestUtils,
TestLocation = require('react-router/modules/locations/TestLocation');
var TestContext = {
getRouterComponent: function(targetComponent) {