Skip to content

Instantly share code, notes, and snippets.

View omarqe's full-sized avatar
👨‍💻
Focusing

Omar Mokhtar omarqe

👨‍💻
Focusing
View GitHub Profile
@omarqe
omarqe / httpd-vhosts.conf
Created February 10, 2019 07:32
Sample vhost file that works with DNSMASQ wildcard.
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
@omarqe
omarqe / gist:7fc1cf5e823e16c2d469b4bf06ad9a92
Created November 5, 2018 17:00
When RN is experiencing "Build input file cannot be found", execute these commands
$ cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../
$ cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../
// URL: https://github.com/facebook/react-native/issues/21168#issuecomment-422431294
@omarqe
omarqe / index.js
Created August 8, 2018 16:52
Keeping asgvard's pull request for re-initialising react-native-swiper autoplay on touch end (for my future use). See https://github.com/leecade/react-native-swiper/pull/640
/**
* react-native-swiper
* @author leecade<leecade@163.com>
*/
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import {
Text,
View,
ViewPropTypes,

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@omarqe
omarqe / markdown.md
Created April 17, 2018 10:02 — forked from jonschlinkert/markdown-cheatsheet.md
A better markdown cheatsheet. I used Bootstrap's Base CSS documentation as a reference.

Typography

Headings

Headings from h1 through h6 are constructed with a # for each level:

# h1 Heading
## h2 Heading
### h3 Heading
@omarqe
omarqe / 0.autoload_setup.php
Created April 5, 2018 07:33 — forked from mhull/0.autoload_setup.php
A basic PHP autoloader setup
<?php
/**
* In this example, we are autoloading classes within the namespace `Acme\ExampleProject`. The file `index.php` is the
* entry point to our project; and we are using the `src` directory to store and organize our PHP class files. Our
* autoloader is located in `autoload.php`
*
* The basic behavior is illustrated in the fact that PHP will autoload the file `src/mammals/human.php` whenever we
* attempt to create a `new \Acme\ExampleProject\Mammals\Human` anywhere in our project's codebase.
*
* This diagram illustrates our project structure. Each file's contents can be found below.
@omarqe
omarqe / app.js
Created March 26, 2018 01:58 — forked from anandgeorge/app.js
Socket.io example with jquery and dom manipulation
var io = require('socket.io').listen(8000),
nicknames = {};
io.sockets.on('connection', function (socket) {
socket.on('user message', function (msg) {
socket.broadcast.emit('user message', socket.nickname, msg);
});
socket.on('nickname', function (nick, fn) {
if (nicknames[nick]) {
@omarqe
omarqe / Hello.java
Created March 1, 2018 01:59
WIF3001 Software Testing (Tutorial 1 Session)
class Hello {
/**
* Effects: if x==null throw NullPointerException else
* return the number of elements in x that are either odd
* or positive (or both).
**/
public static void main(String[] args){
int[] x = {-3,-2,0,1,4};
System.out.println(addOrPos(x));
}
@omarqe
omarqe / index.php
Created January 30, 2018 13:20 — forked from oriolrivera/index.php
Simple Chat Using WebSocket and PHP Socket
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<style type="text/css">
<!--
.chat_wrapper {
width: 500px;
margin-right: auto;
margin-left: auto;
@omarqe
omarqe / GenerateSelfSignedCert.txt
Last active May 4, 2020 04:45
Create a self-signed certificate that Chrome 58 trust. This solution is based on bcardarella's answer https://serverfault.com/q/845766
openssl req -newkey rsa:2048 -x509 -nodes -keyout server.key -new -out server.crt -subj /CN=belanjer.lo -reqexts SAN -extensions SAN -config <(cat /System/Library/OpenSSL/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:belanjer.lo')) -sha256 -days 3650