Skip to content

Instantly share code, notes, and snippets.

@baddot
baddot / nationality.html
Created February 6, 2017 05:55 — forked from didats/nationality.html
Nationality List in HTML Dropdown
<select name="nationality">
<option value="">-- select one --</option>
<option value="afghan">Afghan</option>
<option value="albanian">Albanian</option>
<option value="algerian">Algerian</option>
<option value="american">American</option>
<option value="andorran">Andorran</option>
<option value="angolan">Angolan</option>
<option value="antiguans">Antiguans</option>
<option value="argentinean">Argentinean</option>
@baddot
baddot / webhook.php
Created March 23, 2017 18:32 — forked from visitdigital/webhook.php
Very Simple Facebook Chat Bot PHP Webhook Script Example
<?php
$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
// Set this Verify Token Value on your Facebook App
if ($verify_token === 'testtoken') {
echo $challenge;
}
$input = json_decode(file_get_contents('php://input'), true);
@baddot
baddot / NricUtility.php
Created December 22, 2017 09:51 — forked from mauris/NricUtility.php
A NRIC utility class implemented in PHP. For validating NRIC numbers or generating random NRIC numbers.
<?php
namespace Mauris\Utility;
class NricUtility
{
public static function validate($nric)
{
$nric = strtoupper($nric);
if (strlen($nric) == 9) {
$hash = self::checksum(substr($nric, 0, 8));
@baddot
baddot / facebook_leads.md
Created January 17, 2018 17:17 — forked from tixastronauta/facebook_leads.md
Receiving Facebook Leads on a Webhook

Receiving Facebook Leads on a Webhook

1 - Create an App

Head over to developer.facebook.com and create an App

2 - Setup the webhook

On your server, create a facebook webhook that will handle facebook calls. Then create a "leadgen" webhook on you App: https://developers.facebook.com/docs/graph-api/webhooks/v2.5

@baddot
baddot / Date-Select-Markup.html
Created February 2, 2018 12:52 — forked from aleksblago/Date-Select-Markup.html
Markup: Select options for Month, Day, and Year.
<span>
<select name="month">
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
@baddot
baddot / html-php-date-picker.php
Created February 19, 2018 20:23 — forked from furkanmustafa/html-php-date-picker.php
Date Picker Select Generator for HTML & PHP
<select name="year">
<option value="">Year</option>
<?php for ($year = date('Y'); $year > date('Y')-100; $year--) { ?>
<option value="<?php echo $year; ?>"><?php echo $year; ?></option>
<?php } ?>
</select>
<select name="month">
<option value="">Month</option>
<?php for ($month = 1; $month <= 12; $month++) { ?>
<option value="<?php echo strlen($month)==1 ? '0'.$month : $month; ?>"><?php echo strlen($month)==1 ? '0'.$month : $month; ?></option>
@baddot
baddot / d3-js-tree-layout-chart.markdown
Created October 1, 2019 19:15
D3.js Tree Layout chart

D3.js Tree Layout chart

A basic tree layout with nodes that are aware of the sizes of other nodes. Also supports zoom functionality. I originally created this to answer my own Stackoverflow question on jsFiddle and am simply moving it over to Codepen.

A Pen by Augustus Yuan on CodePen.

License.

@baddot
baddot / index.html
Created October 1, 2019 19:16
Tree Layout - D3js V5
<meta charset="UTF-8">
<style>
.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 3px;
}
@baddot
baddot / d3-hierarchy-layouts.markdown
Created October 1, 2019 19:16
D3 Hierarchy Layouts
@baddot
baddot / collapsible-hierarchy-tree-d3js.markdown
Created October 1, 2019 19:17
Collapsible hierarchy tree d3js