Skip to content

Instantly share code, notes, and snippets.

Avatar

Camilo Payan camilopayan

View GitHub Profile
@camilopayan
camilopayan / list-upcoming-dates.html
Created Dec 7, 2017
I'm trying to get the events whose date is upcoming (after now) and that's failing.
View list-upcoming-dates.html
<ul class="event_list">
{{ range (.Data.Pages.ByParam "event_data.date") }}
{{ if isset .Params "event_data" }}
{{ if ge (time (.Param "event_data.date")).Unix now.Unix }}
<li class="grid-margin-x grid-x">
<div class="cell medium-3 date">
<div class="inner_date">{{ dateFormat "Jan 2" (.Param "event_data.date") }}</div>
</div>
<div class="cell auto">
<a href="{{.Permalink}}" class="title h4">{{.Title}}</a>
View keybase.md

Keybase proof

I hereby claim:

  • I am camilopayan on github.
  • I am camilopayan (https://keybase.io/camilopayan) on keybase.
  • I have a public key ASAK6DUdOHq98-trskPrKGroId-pKF2XeHLsmjRdNOfScwo

To claim this, I am signing this object:

View getMonkey.php
<?php
class AnimalParade
{
private function getMonkey()
{
try {
return $dataSource->wrangleAMonkey();
} catch (NotFoundException $e) {
// The null object pattern, quick and dirty-like
View animal-parade.php
<?php
class AnimalParade
{
public march()
{
$animals = [ $this->getMonkey(), $this->getDog(), $this->getLion() ];
foreach($animals as $animal)
{
$animal->soundOff()
View example-animal.php
<?php
// The real class might look something like this.
class Animal
{
protected $sound;
public function __construct($sound)
{
$this->sound = $sound;
}
@camilopayan
camilopayan / cli.sh
Created Dec 28, 2015
Using Universal Ctags to get everything in composer's vendor folder
View cli.sh
find [PATH TO VENDOR FOLDER] -type f -name '*.php' | grep -v -e "[Tt]est" | xargs ctags -a
@camilopayan
camilopayan / ctags.sh
Created Dec 28, 2015
Universal CTags version of Tim Pope's Effortless CTags for PHP
View ctags.sh
#!/bin/sh
set -e
PATH="/usr/local/bin:$PATH"
dir="`git rev-parse --git-dir`"
trap 'rm -f "$dir/$$.tags"' EXIT
git ls-files | \
ctags \
--tag-relative=yes \
-L - -f"$dir/$$.tags" \
--languages=php,-javascript,sql
@camilopayan
camilopayan / squash-branch.sh
Created Oct 28, 2015
Squash to the parent branch
View squash-branch.sh
git reset --soft origin/[BRANCH NAME]
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
@camilopayan
camilopayan / 0_reuse_code.js
Last active Sep 10, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Specs
Current Rackspace Specs:
250GB HDD
8GB RAM
2GHz CPU AMD Dual Core Opteron 1212
Software:
Red Hat Linux 6
EPEL Repos
PHP 5.4 latest
MySQL
You can’t perform that action at this time.