Skip to content

Instantly share code, notes, and snippets.

View thebiltheory's full-sized avatar
🎯
Focusing

Nabil thebiltheory

🎯
Focusing
View GitHub Profile
@thebiltheory
thebiltheory / Silverpop_instapage_webhook.php
Last active December 16, 2015 16:01
Webhook to send instapage form to silverpop database
<?php
/**
* Silverpop Instapage webhook
*/
// Instapage System vars
$page_id = $_POST[ 'page_id' ];
$page_url = $_POST[ 'page_url' ];
$variant = $_POST[ 'variant' ];
@thebiltheory
thebiltheory / acf_image_function.php
Created December 29, 2015 13:30
Customized function to generates ACF costomized image display.
<?php
/**
* Custom function for ACF to display an customized image field.
*
*/
function tabs_image($img){
$image = get_sub_field($img); //replace get_sub_field by get_field if not subfield
@thebiltheory
thebiltheory / simple_method.js
Created June 11, 2016 09:13 — forked from rponte/simple_method.js
Delaying actions on keypress with jQuery
$('#mySearch').keyup(function() {
clearTimeout($.data(this, 'timer'));
var wait = setTimeout(search, 500);
$(this).data('timer', wait);
});
function search() {
$.post("stuff.php", {nStr: "" + $('#mySearch').val() + ""}, function(data){
if(data.length > 0) {
$('#suggestions').show();
@thebiltheory
thebiltheory / getCoordinates.js
Created September 12, 2016 16:23
Get the browser geolocation
var getCoords = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
var geo_options = {
enableHighAccuracy: true,
maximumAge : 30000,
timeout : 27000
@thebiltheory
thebiltheory / Singleton.js
Last active September 18, 2017 09:48
Singleton example
/**
* Singleton Pattern
* @returns {Object}
*/
let Planet;
{
let instance;
Planet = function () {
@thebiltheory
thebiltheory / gulpfile.js
Last active October 6, 2017 10:19
A base gulp file that with margin for improvement.
/*=====================================*\
Trippy Build Tasks
\*=====================================*/
/*
* TODO: Optimize build process to inject HTML & Javascript with browserSync
*/
const gulp = require('gulp');
const scss = require('gulp-sass');
@thebiltheory
thebiltheory / PriorityQueue.js
Created November 5, 2017 13:51
A minimal implementation of a priority queue. All I needed.
/** Minimalist Priority Queue. */
export default class PriorityQueue {
constructor() {
this.nodes = [];
}
/**
* Enqueue a new element to the Queue
* @param {value} key value of the key item
* @param {number} priority set the priority of the item
@thebiltheory
thebiltheory / README-Template.md
Created December 4, 2017 05:24 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@thebiltheory
thebiltheory / curry.js
Created December 19, 2017 14:21
Add some curry to your functions
let curry = function (tocurry) {
const params = Array.prototype.slice.call(arguments, 1);
return function () {
return tocurry.apply(this, params.concat(
Array.prototype.slice.call(arguments, 0)
));
};
};
{
"currency":"EUR",
"deals":[
{
"transport":"train",
"departure":"London",
"arrival":"Amsterdam",
"duration":{
"h":"05",
"m":"00"