Skip to content

Instantly share code, notes, and snippets.

View chrisvogt's full-sized avatar
🌸
✿◕‿◕

Chris Vogt chrisvogt

🌸
✿◕‿◕
View GitHub Profile
<?php
/**
* API Settings Class
*
* @property string $username
* @property string $password
* @property string $endpoint
*
* @author C1V0 <mail@chrisvogt.me>
*/
@chrisvogt
chrisvogt / el_grabber.php
Last active August 29, 2015 14:11
DOM element grabber using PHP Simple HTML DOM Parser.
<?php
// Include Simple HTML Dom Parser
require_once('simple_html_dom_parser.php');
/**
* @author CJ Vogt <http://chrisvogt.me>
* @uses simple_html_dom
* @see http://simplehtmldom.sourceforge.net/manual.htm
*/
@chrisvogt
chrisvogt / gist:51a6e0ace502850d5154
Created December 26, 2014 22:29
CakePHP add <pre> tag to select returned fields
<?php
public function afterFind($results, $primary = false) {
$html_fields = array('slider', 'social', 'body');
foreach ($html_fields as $needle) {
foreach ($results as $key => $val) {
if (isset($val['Content'][$needle])) {
$results[$key]['Content'][$needle] = $this->_addBeautifyTag(
$results[$key]['Content'][$needle] );
}
}
@chrisvogt
chrisvogt / cakephp_reformat_datetime_in_results.php
Last active August 29, 2015 14:12
Prettify find() datetime results in CakePHP using CakeTime
<?php # /app/Model/AppModel.php
/**
* afterFind() override
*
* @param mixed $results
* @param boolean $primary
* @return mixed
*/
public function afterFind($results, $primary = false) {
@chrisvogt
chrisvogt / gamertag-boxes.php
Created January 19, 2015 06:46
Gamertag boxes
<?php for ($i = 0; $i < count($gamertags); $i++) : ?>
<?php if ($i == 0 || $i % 5 == 0) : ?>
<div class="row">
<?php endif; ?>
<div class="medium-3 columns">
<div class="panel">
<div class="th" href="#">
<img src="<?php echo $gamertags[$i]['Platform']['thumbnail']; ?>">
</div>
<h5>
-- -----------------------------------------------------
-- FancySurvey Schema
-- 02/26/15 14:53:47
-- Author: @c1v0
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Table `users`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `users` (
@chrisvogt
chrisvogt / jquery-get-chrisvogt-projects.js
Last active August 29, 2015 14:23
Access projects.chrisvogt.me api
$(function() {
// add loading image to div
$('#loading').html('loading...');
// run ajax request
$.ajax({
type: "GET",
dataType: "json",
url: "https://projects.chrisvogt.me/api/1.0/all.json",
success: function (data) {
@chrisvogt
chrisvogt / extract-tally-github-commits.js
Last active August 29, 2015 14:23
Use JavaScript to extract and tally all public commits made to GitHub this month. Uses the GitHub web api.
/**
* Extract and tally all public commits made to GitHub this month for a user.
* @author CJ Vogt <mail@chrisvogt.me>
*/
$(function() {
$('#loading').html('loading...');
/**
* Contains GitHub User PushEvents
* @type {object}

Keybase proof

I hereby claim:

  • I am chrisvogt on github.
  • I am chrisvogt (https://keybase.io/chrisvogt) on keybase.
  • I have a public key whose fingerprint is 48DD CA76 067C 9B5C B126 79AC A63F 9EE3 9564 3483

To claim this, I am signing this object:

@chrisvogt
chrisvogt / generic-vagrant-bootstrap.sh
Created July 20, 2015 07:37
A generic Vagrant bootstrap file...
#!/usr/bin/env bash
# -----------------------------
# Vagrant bootstrap script
# -----------------------------
# Update repositories
sudo apt-get update && sudo apt-get upgrade -y -q
# Point the default virtualhost to the app's /webroot directory