Skip to content

Instantly share code, notes, and snippets.

View ultimateprogramer's full-sized avatar

Ahmed Maawy ultimateprogramer

View GitHub Profile
@ultimateprogramer
ultimateprogramer / database.rules.json
Created February 17, 2021 17:05 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@ultimateprogramer
ultimateprogramer / install-kubectl-helm-ubuntu.sh
Last active November 25, 2020 16:40 — forked from onuralp/install-kubectl-helm-ubuntu.sh
This script installs kubectl kubectx and helm to you ubuntu. I usually use docker to connect kubectl. But I created this for some reason. Enjoy
# update
sudo apt-get update
sudo apt-get -qq update
# Install kubectl
sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
sudo chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
# Install kubectx (Switch between Kubernetes contexts/namespaces)
@ultimateprogramer
ultimateprogramer / py-gitignore
Created October 8, 2020 09:22 — forked from MOOOWOOO/py-gitignore
python pycharm gitignore
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Makefile template for a shared library in C
# https://www.topbug.net/blog/2019/10/28/makefile-template-for-a-shared-library-in-c-with-explanations/
CC = gcc # C compiler
CFLAGS = -fPIC -Wall -Wextra -O2 -g # C flags
LDFLAGS = -shared # linking flags
RM = rm -f # rm command
TARGET_LIB = libtarget.so # target lib
SRCS = main.c src1.c src2.c # source files
@ultimateprogramer
ultimateprogramer / README.md
Created August 15, 2020 17:16 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

// uses Apache commons CSV, IO and Lang
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
@ultimateprogramer
ultimateprogramer / raycast.hx
Created July 14, 2020 18:08 — forked from jah2488/raycast.hx
A simple raycasting proof of concept I did a few months back in haxe/openfl. Think of the original doom. Its kinda like that.
package;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.Lib;
import flash.ui.Keyboard;
import flash.Vector;
@ultimateprogramer
ultimateprogramer / firebase_detect_data.js
Created June 19, 2020 21:40 — forked from anantn/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');

Attach the script to a go containing the camera and send a message to that script with four parameters:

  • x = amount of shake in x-direction
  • y = amount of shake in y-direction
  • time = duration of shake in seconds
  • speed = shakes per second - lower number means faster shaking

To try it out you can simply hot reload the script and it will initiate a shake immediately.

@ultimateprogramer
ultimateprogramer / app_route_target.js
Created January 30, 2019 08:45 — forked from hojberg/app_route_target.js
Simple Aviator/React example. Read more about Aviator here: https://github.com/swipely/aviator
/** @jsx React.DOM */
var AppRouteTarget = {
setupLayout: function () {
React.renderComponent({
<App className='page-content'>,
document.querySelector('body')
});
}
};