Skip to content

Instantly share code, notes, and snippets.

View dospuntocero's full-sized avatar

Francisco arenas dospuntocero

View GitHub Profile
@frankmullenger
frankmullenger / GridFieldConfig.php
Created September 13, 2012 03:08
GridField Detail form with relation ID populated
<?php
class GridFieldConfig_HasManyRelationEditor extends GridFieldConfig {
/**
*
* @param int $itemsPerPage - How many items per page should show up
*/
public function __construct($itemsPerPage=null) {
$this->addComponent(new GridFieldButtonRow('before'));
$this->addComponent(new GridFieldAddNewButton('buttons-before-left'));
@wilr
wilr / app._config.routes.yml
Created September 15, 2012 00:29
Basic SilverStripe 3.0 Framework Bootstrap
---
Name: app
After: framework/routes#coreroutes
---
Director:
rules:
'dev': 'DevelopmentAdmin'
'sitemap.xml': 'GoogleSitemap'
'$Action' : 'BaseController'
@phptek
phptek / ss-upgrade.sh
Last active October 11, 2015 18:38 — forked from stojg/ss-upgrade.sh
Search and replace for SS 3.0 upgrade [beta]
#!/bin/bash
#
# ss-upgrader.sh
#
# INTRODUCTION
#
# There are some threads on the SS forums that describe the techdocs for upgrading a 2.4 site to 3.x as being too technical. Mainly from content authors who
# also happen to be site maintainers - they are not coders.
# The aim of this script is to therefore to automate - in as much as this is possible in a user-configured, open-source software project - to help those new to
# SS3 upgrade from 2.x as smoothly as possible.

##Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management

###Instructions to Change PHP Installation

First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Withing the terminal, Fire this command:

which php

@sageworksstudio
sageworksstudio / map.html
Created February 11, 2020 19:06
Interactive map
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
.map {
@dospuntocero
dospuntocero / wordpress multiple loop - group results
Last active March 23, 2020 16:12
looping through a custom post type and its taxonomy. showing results by taxonomy term
<?php
$custom_post_type = 'team_profiles;
$tax_term = 'department';
$terms = get_terms($tax_term);
foreach($terms as $term) :
?>
<h2><?= $term->name;?></h2>
<?php
$cat_posts_args = array(
'post_type' => $custom_post_type,
@sageworksstudio
sageworksstudio / mariadb-cheat-sheet.md
Last active April 17, 2020 20:23
Cheat sheet for mariadb

MariaDB Cheat Sheet

From command line

Export database (with drop tables)

mysqldump -u username -p --add-drop-table database_name > data-dump.sql

Import database
@lolmaus
lolmaus / _heading-sizes.sass
Created December 6, 2013 14:31
A mixin used to generate heading sizes. You provide min and max heading sizes and it calculates all the sizes in between. The sizes can be calculated proportionally or augmented by a ratio. Note that calculating based on a ratio requires the modular-scale extension.
// Requires modular-scale
=heading-sizes($max-size: 30px, $min-size: 16px, $max-heading: 1, $min-heading: 6, $ratio: 1, $debug: false)
$number-of-headings: $min-heading - $max-heading + 1
$scaled-size-of-max-heading: modular-scale($number-of-headings - 1, $min-size, $ratio)
$coefficient: 0
@if $ratio != 1
@if modular-scale(1, 1, octave()) != 2
@felthy
felthy / custom-search-acf-wordpress.php
Last active April 19, 2021 15:11 — forked from fiskhandlarn/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request. Updated to use wpdb prepare() and esc_like().
<?php
/*
##############################
########### Search ###########
##############################
Included are steps to help make this script easier for other to follow
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10
[list_searcheable_acf list all the custom fields we want to include in our search query]
@return [array] [list of custom fields]
@sageworksstudio
sageworksstudio / ServerSetup.md
Last active December 29, 2021 15:18
Ubuntu 20.04 LAMP setup

Ubuntu 20.04 LAMP setup

Note: Because this is my personal cheat sheet, I'm installing a few PHP modules that you may not need if you're not running SilverStripe 4.x.x. Otherwise this is a pretty standard and secure LAMP installation.

SECURITY FIRST: Add a sudo user, require public key authentication and disable root login

Log into the remote machine as root: ssh root@123.45.67.890

First, add the admin user.