Skip to content

Instantly share code, notes, and snippets.

View zilahir's full-sized avatar
🍺

Richard Zilahi zilahir

🍺
View GitHub Profile
import React, { Component } from 'react';
import { Grid, Row, Col } from 'react-flexbox-grid';
import { Cta } from './';
import Api from './../../data';
import ApiHun from './../../dataHun';
class Faq extends Component {
componentDidMount() {
let language = this.props.lang;
@zilahir
zilahir / index.js
Last active May 22, 2018 09:40
send message to slack using firebase cloud function
const functions = require('firebase-functions');
const request = require('request');
exports.addMessageToSlack = functions.https.onRequest((req, resp) => {
return new Promise((resolve, reject) => {
const message = array['message'];
request.post(
"https://hooks.slack.com/X/Y/Z",
{ json: { text: `You have a new message: ${message}`} }
)
@zilahir
zilahir / index.html
Last active May 22, 2018 09:22
form
<!DOCTYPE html>
<head>
<meta charset="utf-8">
</head>
<body>
<form>
<input id="message" type="text">
<input type="submit">submit>
</form>
@zilahir
zilahir / contact.js
Last active May 22, 2018 09:35
process the form
jQuery(function($) {
$(document).ready(function() {
const ajaxurl = '/contact';
$("#chili-contact-form").submit(function(e) {
e.preventDefault();
var messageObject = {
message: $("#message").val();
//invoke the firebase cloud function
$.ajax({
url : ajaxurl,
@zilahir
zilahir / firebase.json
Created May 22, 2018 09:39
firebase settings
{
"hosting": {
"public": "/",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "/contact", "function": "addMessageToSlack"
@zilahir
zilahir / docker-compose.yml
Created November 9, 2018 14:26
docker compose for wordpress
version: '3.6'
services:
nginx:
image: nginx:latest
container_name: nginx
ports:
- '80:80'
- '443:443'
volumes:
- ./nginx:/etc/nginx/conf.d
@zilahir
zilahir / wordpress.config
Created November 9, 2018 14:26
nginx config file for docker wordpress
server {
listen 80;
server_name 127.0.0.1;
root /var/www/html;
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
@zilahir
zilahir / pre-push.sh
Created November 10, 2018 23:18
pre-push lock master branch
#!/bin/bash
protected_branch='master'
policy="\n\n[Policy] Never push code directly to the "$protected_branch" branch! ("$protected_branch" is locked! )\n\n"
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
push_command=$(ps -ocommand= -p $PPID)
@zilahir
zilahir / webpack.config.js
Last active December 30, 2018 22:07
webpack config
const path = require("path");
module.exports = {
resolve: {
alias: {
'node_modules': path.join(__dirname, 'node_modules'),
}
},
entry: {
"common" : "./js/site.js",
@zilahir
zilahir / pre-push.sh
Created January 3, 2019 18:22
protect master branch on git
#!/bin/bash
protected_branch='master'
policy="\n\n[Policy] Never push code directly to the "$protected_branch" branch! (Prevented with pre-push hook.)\n\n"
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
push_command=$(ps -ocommand= -p $PPID)