Skip to content

Instantly share code, notes, and snippets.

View qawemlilo's full-sized avatar

Qawelesizwe Mlilo qawemlilo

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
.square {
border: 1px solid black;
width: 200px;
height: 200px;
margin-bottom: 10px;
}
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #42a5f5;
}
.container {
margin: auto;
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #FDD692;
}
.container {
margin: auto;
(function(window,d){
try {
if (!window) return;
var nav = window.navigator;
var loc = window.location;
var doc = window.document;
var userAgent = nav.userAgent;
var lastSendUrl;
if (userAgent.search(/(bot|spider|crawl)/ig) > -1) return;
@qawemlilo
qawemlilo / forge.sh
Created June 27, 2018 17:32
Laravel Forge Setup Script
#
# REQUIRES:
# - server (the forge server instance)
# - event (the forge event instance)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - callback (the callback URL)
#
@qawemlilo
qawemlilo / distance.sql
Created June 9, 2018 11:15 — forked from Usse/distance.sql
MySQL calculate distance between two latitude/longitude coordinates
CREATE FUNCTION `lat_lng_distance` (lat1 FLOAT, lng1 FLOAT, lat2 FLOAT, lng2 FLOAT)
RETURNS FLOAT
DETERMINISTIC
BEGIN
RETURN 6371 * 2 * ASIN(SQRT(
POWER(SIN((lat1 - abs(lat2)) * pi()/180 / 2),
2) + COS(lat1 * pi()/180 ) * COS(abs(lat2) *
pi()/180) * POWER(SIN((lng1 - lng2) *
pi()/180 / 2), 2) ));
END
@qawemlilo
qawemlilo / Fade.vue
Created May 14, 2018 19:23 — forked from cprass/Fade.vue
Vue component for simple fade-out-in with Velocity.js
<template>
<transition
name="fade"
mode="out-in"
v-on:before-enter="beforeEnter"
v-on:enter="enter"
v-on:before-leave="beforeLeave"
v-on:leave="leave"
>
<slot></slot>
@qawemlilo
qawemlilo / makebook_obfuscate.php
Created March 26, 2018 13:48 — forked from levelsio/makebook_obfuscate.php
Obfuscate your ebook so that people who didn't pay can read it, partly
<?php
/*
I wrote this function to progressively obfuscate text in MAKEbook.io. When it KINDA worked, I just used it.
It can take a lot of improvement. I kinda just tweaked the values until it was good enough. It's not SO progressive though.
It takes all the output of your PHP scripts via ob_start(), reroutes that to the obfuscation function.
You should check if user paid for book or not, then either run ob_start or not!
@qawemlilo
qawemlilo / tweet-package-releases.js
Last active March 19, 2018 08:15
Building a twitter bot for posting the latest package releases on Github
"use strict";
const Twitter = require('twit');
const axios = require('axios');
const moment = require('moment');
const config = require('../.env');
const client = new Twitter({
consumer_key: config.TWITTER_BOT_KEY,
@qawemlilo
qawemlilo / index.android.js
Created April 4, 2017 12:25 — forked from TiagoGouvea/index.android.js
Sample DrawerLayout opened by clicking in a TouchableHighlight component
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,