Skip to content

Instantly share code, notes, and snippets.

View unclecheese's full-sized avatar

Aaron Carlino unclecheese

View GitHub Profile
@unclecheese
unclecheese / create-feature
Created September 22, 2014 23:31
Bash script for creating new hotfix branch
#!/bin/sh
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "master" ];then
echo $CURRENT_BRANCH
echo "Please switch to the master branch to start a new feature."
exit
fi
echo "What is the name of this feature (e.g. my-feature-name)? "
@unclecheese
unclecheese / .bash_profile
Last active August 29, 2015 14:06
Git command line helpers
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
#!/bin/sh
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > ~/git-prompt.sh
curl https://gist.githubusercontent.com/unclecheese/acdf2139a348d0c73910/raw/4192c8f5e81d088d8559920878cfa448fd1e7644/.bash_profile >> ~/git-prompt.sh
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/git-completion.bash
chmod +x ~/git-prompt.sh
@unclecheese
unclecheese / code, Page.php
Created October 1, 2014 21:56
Custom login for SilverStripe
class Page extends SiteTree {
public function IsLostPassword() {
return in_array(Controller::curr()->getRequest()->param('Action'), array("lostpassword","passwordsent","changepassword"));
}
}
@unclecheese
unclecheese / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
class GraphQLScaffolder
{
const READ
const UPDATE
const DELETE
const CREATE
/**
<?php
class YourPage extends Page
{
private static $has_one = [
'Slideshow1' => 'Image',
'Slideshow2' => 'Image',
// etc..
];
@unclecheese
unclecheese / Page_Controller.php
Created October 28, 2017 22:17
SS ajax site search
<?php
class Page_Controller extends ContentController
{
public function init()
{
parent::init();
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
Requirements::javascript('themes/simple/javascript/script.js');
}
<?php
class GridFieldRegistry
{
public function add($identifier, GridField $gridField)
{
if ($identifierIsNotUnique) { throw... }
$this->registry[] = new GridFieldRegistration(
$identifier,
<?php
namespace SilverStripe\GraphQL\Scaffolding\Scaffolders\CRUD;
use Exception;
use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\ResolveInfo;
use SilverStripe\Core\ClassInfo;
use SilverStripe\GraphQL\Manager;
use SilverStripe\GraphQL\OperationResolver;