Skip to content

Instantly share code, notes, and snippets.

View abachuk's full-sized avatar
✍️
dev manager by day, writing code at night

Alex Bachuk abachuk

✍️
dev manager by day, writing code at night
View GitHub Profile
@abachuk
abachuk / gist:4478258
Created January 7, 2013 20:49
Outlook background image hack
<!--[if gte mso 9]>
<v:image xmlns:v="urn:schemas-microsoft-com:vml" id="theImage" style='behavior: url(#default#VML); display: inline-block; position: absolute; width: 374px; height: 246px; top: 0; left: 130px; border: 0; z-index: 1;' src="/imgs/myPhoto.png" />
<v:shape xmlns:v="urn:schemas-microsoft-com:vml" id="theText" style='behavior: url(#default#VML); display: inline-block; position: absolute; width: 374px; height: 246px; top: -5; left: 125px; border: 0; z-index: 2;'>
<div>
<![endif]-->
<table style="background: /imgs/myPhoto.png”>
</table>
<!--[if gte mso 9]>
</div>
</v:shape>
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import moxios from 'moxios';
import expect from 'expect';
import * as actions from './getPosts';
import getPostsMock from '../../mocks/getPostsMock';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
import reducer from './getPostReducer';
import * as actions from '../actions/posts/getPost';
import { UPDATE_POST_SUCCESS } from '../actions/posts/updatePost';
import expect from 'expect';
import getPostMock from '../mocks/getPostMock';
describe('post reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual({});
});
// let's define our expiration date
const today = new Date();
let expDate = new Date();
expDate.setDate(today.getDate() + 30); // 30 days expiration
// a searches user does in your app on the first visit, we collect them to save to localStorage
const userRecentlocations = [
{ city: "New York", country: "US", id: "2390230" },
{ city: "Athens", country: "GR", id: "304802" },
{ city: "Kyiv", country: "UA", id: "1239488" }
const fruits = {
apples: 3,
bananas: 4,
pears: 1,
blackberries: 8
}
// always check if Storage is available
if (typeof(Storage)) {
// saving the object (or JSON) to localStorage
// Redux action
export function uploadSuccess({ data }) {
return {
type: 'UPLOAD_DOCUMENT_SUCCESS',
data,
};
}
export function uploadFail(error) {
return {
import axios from 'axios';
export const GET_POSTS_START = 'GET_POSTS_START';
export const GET_POSTS_SUCCESS = 'GET_POSTS_SUCCESS';
export const GET_POSTS_FAIL = 'GET_POSTS_FAIL';
const getPostsStart = () => ({
type: GET_POSTS_START,
});
// modules.js
export function drive(props) {
return props.gas
}
export function fly(props) {
return props.miles
}
// main.js
import AWS from 'aws-sdk';
import { CognitoUserPool, AuthenticationDetails, CognitoUser } from 'amazon-cognito-identity-js';
export default function signinHandler(body) {
const authData = JSON.parse(body);
AWS.config.region = 'us-east-1';
const authenticationDetails = {
Username: authData.username,
Password: authData.password,
};
// after all babel and webpack configs
import AWS from 'aws-sdk';
import { CognitoUserPool } from 'amazon-cognito-identity-js';
export default function signupHandler(body) {
const userData = JSON.parse(body);
AWS.config.region = 'us-east-1';
const poolData = {