Skip to content

Instantly share code, notes, and snippets.

View mooror's full-sized avatar
🚀
Working on our web platform

Benjamin mooror

🚀
Working on our web platform
View GitHub Profile
@mooror
mooror / _button.scss
Last active November 19, 2018 22:34
Iota Css Example Code - Button component file for those who are following along with the "Button Component" iota CSS Tutorial
// Button Component Settings
$button-padding: $baseline-x2 $baseline-x3;
$button-bgcolor: $color-blue;
$button-bgcolor-hover: darken($color-blue, 10%);
$button-color: $color-white;
$button-radius: 3px;
$button-outline-padding: ($baseline-x2 - 2) ($baseline-x3 - 2);
$button-outline-bgcolor: transparent;
$button-outline-color: $color-blue;
@mooror
mooror / Global Settings.scss
Created November 19, 2018 03:36
Global settings file for those who are following along with the "Global Settings" iota CSS Tutorial
// Baseline Settings
$baseline: 7px;
$baseline-x2: $baseline * 2;
$baseline-x3: $baseline * 3;
$baseline-x4: $baseline * 4;
$baseline-x5: $baseline * 5;
$baseline-x6: $baseline * 6;
$baseline-x7: $baseline * 7;
$baseline-x8: $baseline * 8;
<?php
...
$download = $request->getVar("download") ? true : false;
if ($download) {
// Get the the product file path,name,type, and size
$productFile = $product->FullUpload()->getAbsoluteURL();
$productFileName = $product->FullUpload()->getFilename();
$productFileType = $product->FullUpload()->getMimeType();
$productFileSize = $product->FullUpload()->getAbsoluteSize();
// Update the HTTPResponse object with the proper download headers
<?php
//...
public static function generateUniqueID($uniqueID)
{
// Get the products ID and ID length and store them
$prefix = $uniqueID."-";
$prefixLength = strlen($prefix);
// Generate a unique identifier approximatly 23 characters long
// and remove any periods
$identifier = uniqid("", true);
@mooror
mooror / index.php
Last active October 14, 2018 18:24
Proposal for iteratable/non-iteratable abstraction via callbacks (in php)
<?php
class Person {
protected $name;
protected $age;
public function __construct($name, $age){
$this->name = $name;
$this->age = $age;
<?php
namespace Sitelease\PaypalAutoSeller\Extensions;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\ArrayList;
use SilverStripe\View\ArrayData;
use Sitelease\PaypalAutoSeller\Model\PrivateProduct;
@mooror
mooror / LeftAndMain.php
Created August 27, 2018 01:11
The save method that triggers the green alert box.
<?php
// ...
/**
* Save handler
*
* @param array $data
* @param Form $form
* @return HTTPResponse
<?php
/**
* Description
*
* @package silverstripe
* @subpackage mysite
*/
class MealCategory extends DataObject
{
/**
@mooror
mooror / snippets.cson
Created February 21, 2018 04:21
A series of php snippets for the Atom editer
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@mooror
mooror / CustomDataObject.php
Created August 14, 2017 00:29
SS3 DataObject Permissions Functionality
<?php
class CustomDataObject extends DataObject implements PermissionProvider
{
static $api_access = true;
static $permissionsSuffix = "CUSTOMDATAOBJECT"; // Permission code will be ACTION_SUFFIX
static $permissionsDescriptor = "Custom";
static $permissionsCategory = 'Custom Object';
static $permissionsActionsArray = array('view','edit','delete','create');