Skip to content

Instantly share code, notes, and snippets.

View tarex's full-sized avatar
🎯
Focusing

Tareq Jobayere tarex

🎯
Focusing
View GitHub Profile
@tarex
tarex / cert-manager-nginx-ingress-gke-recipe.md
Created July 28, 2019 11:18
A quickstart guide to deploying cert-manager and nginx-ingress on GKE

This is a quick recipe for deploying cert-manager and nginx-ingress on GKE to obtain SSL certificates from Lets Encrypt. Whilst this recipe is designed for Google Cloud Platform, it can easily be adapted for other cloud platforms.

We'll begin with a Kubernetes cluster, and we'll obtain authentication credentials.

gcloud container clusters get-credentials my-test-app
kubectl config current-context
kubectl get nodes
@tarex
tarex / component.tsx
Created March 13, 2019 10:53 — forked from chrislopresto/component.tsx
styled-components v4 + createGlobalStyle + TypeScript
import * as React from 'react';
import { theme } from './theme';
import { ThemeProvider, createGlobalStyle } from './styled-components';
const GlobalStyle = createGlobalStyle`
body {
font-family: Times New Roman;
}
`;
@tarex
tarex / formik.tsx
Created February 26, 2019 12:55 — forked from tgriesser/formik.tsx
Formik w/ Hooks
import React, {
useContext,
createContext,
createElement,
useEffect,
useRef,
useCallback,
useState,
} from 'react';
import isEqual from 'react-fast-compare';
@tarex
tarex / _ide_helper.php
Created November 5, 2018 11:19 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@tarex
tarex / elasticsearch-example.js
Created January 1, 2018 19:28 — forked from StephanHoyer/elasticsearch-example.js
Simple example how to use elastic search with node.js
'use strict';
var elasticsearch = require('elasticsearch');
var Promise = require('bluebird');
var log = console.log.bind(console);
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
@tarex
tarex / consumer.php
Created October 28, 2017 21:35 — forked from fbrnc/consumer.php
AWS Kinesis Example for PHP (using the AWS SDK for PHP)
<?php
// curl -sS https://getcomposer.org/installer | php
// php composer.phar require aws/aws-sdk-php
// export AWS_ACCESS_KEY_ID=...
// export AWS_SECRET_ACCESS_KEY=...
$streamName = '<INSERT_YOUR_STREAMNAME_HERE>';
$numberOfRecordsPerBatch = 10000;
@tarex
tarex / snippets.coffee
Created August 22, 2017 21:25 — forked from tj/snippets.coffee
Atom snippets for Go
'.source.go':
'Options':
'prefix': 'options'
'body': '''
// Option function.
type Option func(*$1)
// New with the given options.
func New(options ...Option) *$1 {
@tarex
tarex / rules.json
Created July 3, 2017 05:54 — forked from davideast/rules.json
Bolt output
{
"rules": {
"users": {
"$uid": {
".validate": "newData.hasChildren(['uid', 'name', 'username'])",
"uid": {
".validate": "newData.isString()"
},
"name": {
".validate": "newData.isString()"
@tarex
tarex / SyncPath.js
Created July 3, 2017 05:53 — forked from davideast/SyncPath.js
Firebase Social Network Client Fanout
export class SyncPath {
constructor(rootRef, path) {
this._rootRef = rootRef;
this.user = this._rootRef.getAuth();
this._userDataRef = this._rootRef.child(path).child(this.user.uid);
this.data = {};
this._userDataRef.on('value', (snap) => this.data = snap.val() || {});
}
keys() {
return Object.keys(this.data);
@tarex
tarex / data-structure.js
Created June 29, 2017 18:24 — forked from sararob/data-structure.js
Role-based security in Firebase
/*
This example shows how you can use your data structure as a basis for
your Firebase security rules to implement role-based security. We store
each user by their Twitter uid, and use the following simplistic approach
for user roles:
0 - GUEST
10 - USER
20 - MODERATOR