Skip to content

Instantly share code, notes, and snippets.

View muskie9's full-sized avatar

Nic muskie9

View GitHub Profile
@camfindlay
camfindlay / SilverStripe on Heroku
Last active March 11, 2021 04:26
SilverStripe database setup on Heroku.
mysite/_config.php
<?php
// . . . config above
//Heroku ClearDB support
if(isset($_ENV['CLEARDB_DATABASE_URL'])) {
global $databaseConfig;
$parts = parse_url($_ENV['CLEARDB_DATABASE_URL']);
$databaseConfig['type'] = 'MySQLDatabase';
$databaseConfig['server'] = $parts['host'];
$databaseConfig['username'] = $parts['user'];
@Zauberfisch
Zauberfisch / BaseValidator.php
Last active August 29, 2015 14:13
Better SilverStripe Form Validator
<?php
/**
* @author zauberfisch
*/
class BaseValidator extends Validator {
protected $validateFields, $requireFields;
/**
* @param bool|string[]|\FormField[]|\FieldList $validateFields
@dljoseph
dljoseph / SS-modelAdmin.php
Created November 22, 2014 09:05
SilverStripe 3.1.x add date range filters to modeladmin
<?php
class MyDataObjectAdmin extends ModelAdmin {
private static $managed_models = array('MyDataObject'); // Can manage multiple models
private static $url_segment = 'my-data-object'; // Linked as /admin/my-data-object/
private static $menu_title = 'My DataObjects';
public function getSearchContext() {
@roachhd
roachhd / README.md
Last active June 7, 2024 09:32
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

@mpalourdio
mpalourdio / php-cs-fixer
Created November 12, 2014 21:24
@fabpot php-cs-fixer config for PhpStorm
parameters
--level=psr2 --verbose fix $FileDir$/$FileName$
working directory
$ProjectFileDir$
@wernerkrauss
wernerkrauss / post-merge
Last active April 18, 2016 10:08
git post-merge hook for silverstripe installs.
#!/bin/bash
echo "running git post receive hook..."
DIR=$(git rev-parse --show-toplevel)
composer.phar install --no-dev -o
echo "running dev/build"
sudo -u www-data php $DIR/framework/cli-script.php dev/build flush=1
@halkyon
halkyon / gist:ec08493c2906c1539a49
Last active June 18, 2019 23:08
BuildTask for SilverStripe to remove obsolete tables, columns and indexes from the database
<?php
/**
* Remove old tables, columns, and indexes from a SilverStripe database.
*
* Define your obsolete tables, columns and indexes in {@link $deleted_tables},
* {@link deleted_columns} and {@link deleted_indexes} and these will be deleted
* from the database.
*
* In addition to that, it will automatically remove any tables and columns prefixed with "_obsolete".
*/
@jedateach
jedateach / _ss_environment.php
Created May 16, 2014 21:45
Localhost ss environment file
<?php
//set up reporting level, depending on ss version
if(strrpos($_SERVER['SCRIPT_NAME'], 'sapphire') !== false){
error_reporting(E_ERROR | E_WARNING | E_PARSE);
}else{
error_reporting(E_ALL);
}
define('SS_GEM_PATH', '/usr/bin/');
@tractorcow
tractorcow / Banner.php
Created May 15, 2014 01:53
How to use ListboxField (multiple selection)
<?php
/**
* For cool guy @BenENewton
*/
class Banner extends DataObject {
private static $db = array(
'Title' => 'Varchar'
);
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 4, 2024 04:16
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.