Skip to content

Instantly share code, notes, and snippets.

View otengkwame's full-sized avatar
💭
Cooking some open source projects

Kwame Oteng Appiah-Nti otengkwame

💭
Cooking some open source projects
View GitHub Profile
<?php
$arr = array(1, 2, 3);
/**
* PHP Weirdness 1
* 'continue' acts like 'break' inside of a switch statement when inside of a loop
* whereas 'continue' acts as expected inside an elseif block
*/
foreach ($arr as $item) {
switch($item) {
@otengkwame
otengkwame / contact.html
Created December 22, 2017 06:19 — forked from ajtroxell/contact.html
Build a simple PHP, jQuery, and AJAX Powered Contact Form, from: http://ajtroxell.com/build-a-simple-php-jquery-and-ajax-powered-contact-form/
<form id="contact" name="contact" method="post">
<fieldset>
<label for="name" id="name">Name<span class="required">*</span></label>
<input type="text" name="name" id="name" size="30" value="" required/>
<label for="email" id="email">Email<span class="required">*</span></label>
<input type="text" name="email" id="email" size="30" value="" required/>
<label for="phone" id="phone">Phone</label>
<input type="text" name="phone" id="phone" size="30" value="" />
@otengkwame
otengkwame / index.html
Created July 5, 2018 04:35
Modal Complete
<header>
<img src="https://richardmiddleton.me/comic-60.png" alt="">
<ul>
<li><a href="">Home</a></li>
<li><a href="">About</a></li>
<li><a href="">Blog</a></li>
<li><a href="">Signup</a></li>
<li><a href="">Contact</a></li>
</ul>
</header>
@otengkwame
otengkwame / action-button-with-checkbox-trick-no-js.markdown
Created August 18, 2018 14:06
action button with checkbox trick (NO JS)
@otengkwame
otengkwame / base_url_for_ci.txt
Last active August 27, 2018 16:56 — forked from onubadev/gist:3ba272d8cee68dcc49892d22e7bac4fd
Codeigniter dynamic HTTP/HTTPS base url
#in config.php
$base_url=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$base_url.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base_url;
@otengkwame
otengkwame / gist:ed1ef935d5812909e6236f01005cc12e
Created August 28, 2018 19:14 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@otengkwame
otengkwame / Email Server (Linux, Unix, Mac).md
Created September 2, 2018 20:58 — forked from raelgc/Email Server (Linux, Unix, Mac).md
Setup a Local Only Email Server (Linux, Unix, Mac)

Setup a Local Only Email Server (Linux, Unix, Mac)

1 - Point localhost.com to your machine

Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to make the domain localhost.com point to your machine, including this content to the file:

127.0.0.1 localhost.com

2 - Install Postfix

@otengkwame
otengkwame / vuejs-php.md
Created September 2, 2018 22:03 — forked from happygrizzly/vuejs-php.md
VueJs and PHP

VueJs and PHP

Setup

First test

@otengkwame
otengkwame / vuejs-php.md
Created September 2, 2018 22:03
VueJs and PHP
@otengkwame
otengkwame / index.html
Created November 14, 2018 22:37
Sticky videos
<div class="page">
<div class="video-wrap">
<div class="video">
<iframe width="600" height="340" src="https://www.youtube.com/embed/pfqkRYSs4Rg" frameborder="0" gesture="media" allowfullscreen></iframe>
</div>
</div>
<div class="content">
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Animi blanditiis recusandae distinctio optio commodi tenetur quisquam qui porro, aliquid inventore perferendis quibusdam at! Quisquam illum distinctio eveniet corrupti cupiditate quis?</p>