Skip to content

Instantly share code, notes, and snippets.

@croosen
croosen / create-lambda-zip.sh
Last active May 6, 2019 10:19
Create lambda.zip
$ npm install - production
$ ./bundle.sh
@croosen
croosen / aws-api-clone-apigateway.sh
Last active May 6, 2019 10:19
Clone the example from the multi-user ToDo application from chapter 10 in Amazon Web Services in Action.
$ git clone git@github.com:AWSinAction/apigateway.git
$ cd apigateway/
@croosen
croosen / paginate.php
Created September 26, 2017 08:04
PHP pagination
// A PHP pagination, based on this tutorial: https://code.tutsplus.com/tutorials/how-to-paginate-data-with-php--net-2928
// Adjusted for own use, fixed some bugs (prev/next links did not stop counting after first or last page was reached)
function pagination($page, $total, $limit, $url)
{
$links = 1; // links to show next to the current link, e.g. 1 = 3 links max.
$list_class = "paginate"; // classname for the pagination list
$limit = $limit ? $limit : 10; // posts per page
$page = $page ? $page : 1; // currentpage
@croosen
croosen / index.css
Created May 22, 2017 17:57
Testing Repl.it created by croosen - https://repl.it/IL37/1
Empty file
@croosen
croosen / index.css
Created May 22, 2017 17:56
Testing Repl.it created by croosen - https://repl.it/IL37/0
Empty file
/*----------------------------------------------------
* Slider, fancy nudgy hover effect
/*----------------------------------------------------*/
function nudgeSlider(){
const $slickNext = $('.slick-next');
const $slickPrev = $('.slick-prev');
const $slickTrack = $('.slick-track');
$slickNext.add($slickPrev).each(function(){
const $this = $(this);
'''
Tailz
'''
class Empty:
def __init__(self):
self.isEmpty = True
class Node:
def __init__(self, value, tail):
@croosen
croosen / tictactoe.py
Last active February 25, 2016 10:37
Tic Tac Toe in Python
'''
Tic Tac Toe
A very (very) basic game in Python
'''
def tictactoe():
#create an empty raster
def makeRaster(row, col):
@croosen
croosen / group-product-categories.php
Created December 9, 2015 13:18
Groups WP taxonomies by parent
foreach( get_terms( 'product-categories', array( 'hide_empty' => false, 'parent' => 0 ) ) as $parent_term ) {
// display top level term name
echo $parent_term->name;
foreach( get_terms( 'product-categories', array( 'hide_empty' => false, 'parent' => $parent_term->term_id ) ) as $child_term ) {
// display name of all childs of the parent term
echo $child_term->name;
}
}