Skip to content

Instantly share code, notes, and snippets.

View kamaroly's full-sized avatar

Kamaro Lambert kamaroly

View GitHub Profile
/* Gmail style scrollbar */
::-webkit-scrollbar {
width: 12px
}
::-webkit-scrollbar-thumb {
border-width: 1px 1px 1px 2px
}
::-webkit-scrollbar-track {
border-width: 0
}
@kamaroly
kamaroly / form.html
Last active August 29, 2015 14:20 — forked from gosseti/form.html
<form accept-charset="UTF-8" action="/payment" class="cardInfo" method="post">
<fieldset class="cardInfo__cardDetails">
<div class="form-row cardInfo__cc-num">
<label for="cc-num"><abbr title="required">*</abbr><span>Card Number</span></label>
<div class="cc-num__wrap">
<!-- using type="tel" because type="number" doesn’t pass HTML5 form validation with jQuery.payment formatting -->
<input id="cc-num" type="tel" class="paymentInput cc-num" placeholder="•••• •••• •••• ••••" autocompletetype="cc-number" required="required">
<span class="card" aria-hidden="true"></span>
@kamaroly
kamaroly / form.html
Last active August 29, 2015 14:24 — forked from gosseti/form.html
<form accept-charset="UTF-8" action="/payment" class="cardInfo" method="post">
<fieldset class="cardInfo__cardDetails">
<div class="form-row cardInfo__cc-num">
<label for="cc-num"><abbr title="required">*</abbr><span>Card Number</span></label>
<div class="cc-num__wrap">
<!-- using type="tel" because type="number" doesn’t pass HTML5 form validation with jQuery.payment formatting -->
<input id="cc-num" type="tel" class="paymentInput cc-num" placeholder="•••• •••• •••• ••••" autocompletetype="cc-number" required="required">
<span class="card" aria-hidden="true"></span>
@kamaroly
kamaroly / streamed.php
Created November 3, 2015 07:46 — forked from m4tthumphrey/streamed.php
Laravel response macro for streamed responses with seeking support
<?php
Response::macro('streamed', function($type, $size, $name, $callback) {
$start = 0;
$length = $size;
$status = 200;
$headers = [
'Content-Type' => $type,
'Content-Length' => $size,
@kamaroly
kamaroly / ingest.php
Created March 7, 2016 08:48 — forked from lalinsky/ingest.php
Simple audio fingerprint matching in PHP
<?php
include "utils.php";
$fp = parse_fp($_GET['fp']);
$dbh = new PDO('mysql:host=localhost;dbname=fingerprint', 'fingerprint');
$dbh->beginTransaction();
$sth = $dbh->prepare("INSERT INTO fp (length) VALUES (?)");
@kamaroly
kamaroly / SftpServiceProvider.php
Created June 17, 2016 08:46 — forked from rtconner/SftpServiceProvider.php
Provider so you can add a 'sftp' connection in Laravel 5 filesystems.php - "Call to undefined method League\Flysystem\Filesystem::createSftpDriver"
<?php
namespace App\Providers;
use League\Flysystem\Sftp\SftpAdapter;
use Storage;
use League\Flysystem\Filesystem;
use Illuminate\Support\ServiceProvider;
/**
<?php
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
/////////////////////////////////////////////////////////////////////////
// IF WE HAVE TOOBAR AND MENUBAR WE ASSUME THIS IS NOT FROM MOBILE APP //
/////////////////////////////////////////////////////////////////////////
if (window.toolbar.visible && window.menubar.visible) {
var appIcon = window.document.getElementById('app-icon');
appIcon.style.display = "block";
}
@kamaroly
kamaroly / Round Robin Generator
Created December 13, 2016 09:35
If you've ever been involved in chess tournaments, you would know they come in various formats, one of which is the round robin format. In a round robin, each player plays every other player, and the difference in colours is kept to a minimum, with half the field having white for one more game than the other half. I couldnt come up with a good e…
<?php
/************************************************
* Round Robin Pairing Generator
* Author: Eugene Wee
* Date: 23 May 2005
* Last updated: 23 May 2005
* Copyright (c) 2005 Eugene Wee
* Licensed under the Academic Free License 2.1
* Based on algorithm by Tibor Simko
************************************************/
@kamaroly
kamaroly / ajax_form_validation.js
Created December 14, 2016 09:06
When you have a laravel project with a form and you would like to make jquery ajax form submit and validation, you can use below codes,
$(function(){
$('.form-horizontal').on('click', function(e){
e.preventDefault();
var $form = $('.form-horizontal');
var url = $form.attr('action');
var method = $form.attr('method');
$.ajax({
url: url,
type: method,
data: $form.serialize(),