Skip to content

Instantly share code, notes, and snippets.

@shlomitc
shlomitc / gist:4b99cab22d79e8a5d4d9a76a91ba074f
Created October 7, 2020 19:38
create css classes during runtime
<style
dangerouslySetInnerHTML={{
__html: `
.my-class {
color: red;
}
}}
></style>
@shlomitc
shlomitc / apis-composition-wrapping.md
Last active April 2, 2019 14:19
Components APIs - Composition vs. Wrapping

Components APIs - Composition vs. Wrapping

The Task:

Create a preview component for social links:

image

The component should be created on top of existing components in the library. Consider the following components:

  1. Text - represnets text in different combinations
@shlomitc
shlomitc / ModelExample.js
Created September 4, 2018 17:10
An example showing how to test the content of a wix-style-react Modal (same approach for Tooltip)
import React from 'react';
import Modal from 'wix-style-react/Modal';
import Button from 'wix-style-react/Button';
import {MessageBoxFunctionalLayout} from 'wix-style-react/MessageBox';
class ModalExample extends React.Component {
state = {open: false};
handleToggleModal = () => this.setState({open: !this.state.open});
import React from 'react';
import {findDOMNode} from 'react-dom';
import css from './App.scss';
import HTML5Backend from 'react-dnd-html5-backend';
import {DragDropContext, DragSource, DropTarget} from 'react-dnd';
//PHASE
class Phase extends React.Component {
import React from 'react';
import PropTypes from 'prop-types';
import styled, {ThemeProvider} from 'styled-components';
// Button/Button.js (The basic component)
const Button = ({className, children}) => (
<button className={className}>
{children}
</button>
);
@shlomitc
shlomitc / gql-apollo-test.spec.js
Last active January 20, 2018 02:27
A working example of graphql and apollo client test
import 'mocha';
import {expect} from 'chai';
import 'isomorphic-fetch';
import ApolloClient from 'apollo-client';
import gql from 'graphql-tag';
import {print} from 'graphql-tag/bundledPrinter';
describe('some test', () => {
it('should pass', () => {
@shlomitc
shlomitc / example
Created December 29, 2016 12:09
React context usage and overriding example
import React from 'react';
class A extends React.Component {
render() {
return (
<div>
<h1>A</h1>
<B/>
</div>
);
@shlomitc
shlomitc / index.html
Last active August 10, 2016 19:30 — forked from anonymous/index.html
Angular Directive Compilation Order
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body ng-app="myApp">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<parent>
@shlomitc
shlomitc / gist:d050f0c2729002848ad4a146d24d4421
Created August 1, 2016 07:00
Get an angular service from console
angular.element(document.body).injector().get('serviceName');