Skip to content

Instantly share code, notes, and snippets.

View johnhalsey's full-sized avatar

John Halsey johnhalsey

View GitHub Profile
@johnhalsey
johnhalsey / Pagination.vue
Created July 15, 2019 08:56
VueJS Pagination with TailwindCSS
<template>
<div class="">
<ul v-if="pages" class="list-reset">
<li class="inline-block bg-white hover:bg-blue-lightest border mr-1">
<a href="#"
class="no-underline text-grey-darker block py-3 px-4"
:class="{'bg-grey-lightest text-grey cursor-not-allowed': currentPage == 1}"
@click.prevent="getPreviousPage">Previous</a>
</li>
<li v-for="(page, index) in range"
@johnhalsey
johnhalsey / InvokeMethod.php
Created April 8, 2019 14:52
Call a PHP private or protected method (good for tests)
/**
* Call protected/private method of a class.
*
* @param object &$object Instantiated object that we will run method on.
* @param string $methodName Method name to call
* @param array $parameters Array of parameters to pass into method.
*
* @return mixed Method return.
* @throws \ReflectionException
*/
@johnhalsey
johnhalsey / Modal.vue
Last active January 8, 2019 11:56
VueJS Bootstrap Modal
<template>
<div class="modal" :class="{'show': show}">
<div class="modal-content">
<div class="header p-5">
<div class="row">
<div class="col-sm-10">
<h3 class="modal-title mt-0">Modal Header</h3>
</div>
<div class="col-sm-2 text-right">
<button class="h-100 bg-transparent border-0 text-white" @click="closeModal">
@johnhalsey
johnhalsey / Pagination.vue
Last active December 14, 2018 15:22
VueJS Pagination with Bootstrap 4
<template>
<div id="url-list-table_paginate" class="dataTables_paginate paging_simple_numbers">
<ul v-if="pages" class="pagination">
<li class="paginate_button page-item previous"
:class="{'disabled': currentPage == 1}">
<a href="#"
class="page-link"
aria-controls="url-list-table"
@click.prevent="getPreviousPage">Previous</a>
</li>