Skip to content

Instantly share code, notes, and snippets.

@suciuvlad
suciuvlad / main-service.tsx
Last active July 14, 2018 11:14
graphql-microservices-example
import { introspectSchema, makeRemoteExecutableSchema, mergeSchemas } from 'graphql-tools';
import { createHttpLink } from 'apollo-link-http';
import fetch from 'node-fetch';
const createSchema = async () => {
const movieServiceLink = createHttpLink({
uri: `https://w5vwzkn9zz.lp.gql.zone/graphql`,
fetch
});
@suciuvlad
suciuvlad / movie-service.ts
Last active July 14, 2018 09:53
graphql-microservices-example
import { makeExecutableSchema } from 'graphql-tools';
const movies = [
{ id: 1, title: 'American Pie 2', releaseDate: 1980 },
{ id: 2, title: 'Iron Man', releaseDate: 2001 }
];
const typeDefs = `
@suciuvlad
suciuvlad / nginx.conf
Last active June 26, 2018 09:33
jira and confluence nginx
http {
server {
listen 80;
server_name jira.domain.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
client_max_body_size 10M;
@suciuvlad
suciuvlad / intercom.js
Last active January 13, 2025 04:04
intercom
//Set your APP_ID
var APP_ID = "keznqdgj";
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;
s.src='https://widget.intercom.io/widget/' + APP_ID;
window.Intercom('boot', {
app_id: 'abc12345',
email: 'example@example.com',
user_id: 'abc123',
@suciuvlad
suciuvlad / fp.js
Created October 27, 2017 12:50
functional programming
const compose = (...fns) => x => fns.reduceRight((v, f) => f(v), x);
let curry = fn => { // (1)
let arity = fn.length; //(2) number of arguments fn expects
return (...args) => { // (3)
let firstArgs = args.length; // (4)
if (firstArgs >= arity) { //correct number of arguments
return fn(...args); // (5)
} else {
import React, { Component } from 'react';
import { connect } from 'react-redux'
import { resetForm } from './actions';
const getDisplayName = WrappedComponent => {
return WrappedComponent.displayName || WrappedComponent.name;
}
const ReduxForm = (WrappedComponent, props) => {
const displayName = getDisplayName(WrappedComponent);
@suciuvlad
suciuvlad / .htaccess
Last active July 8, 2017 07:46
wordpress + cloudfront + ssl + reverse proxy
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@suciuvlad
suciuvlad / curried-add.js
Created October 13, 2016 15:20
Curried Add
function add(a,b,c){ return a+b+c; }
function curry(fn) {
return function curried() {
var args = [].slice.call(arguments);
return args.length >= fn.length ?
fn.apply(null, args) :
function () {
var rest = [].slice.call(arguments);
console.log(args);
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
@mixin padding($suffix: null) {
@if ($suffix != null) {
$suffix: \@#{$suffix};
}
@suciuvlad
suciuvlad / Enhance.js
Created July 2, 2016 16:20 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {