Skip to content

Instantly share code, notes, and snippets.

Eduardo Martinez eduardomart

Block or report user

Report or block eduardomart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zomars
zomars / boltflow-bitbucket-deploy.php
Last active Apr 7, 2017
Script to deploy from bitbucket via webhook and bobdenotter's Boltflow script (https://github.com/bobdenotter/boltflow)
View boltflow-bitbucket-deploy.php
<?php
$repo_dir = '/home/username';
$branch_to_deploy = 'master';
$update = false;
// Parse data from Bitbucket hook payload
$payload = json_decode($_POST['payload']);
if (empty($payload->commits)) {
View CSVResponse.php
<?php
namespace MyApp\Response;
use Symfony\Component\HttpFoundation\Response;
class CsvResponse extends Response
{
protected $data;
View extend-upload.php
<?php
// This line needs to be called after initialize but before run
$app['upload'] = $app->extend(
'upload',
function ($handler, $app) {
if ($app['request']->get('contenttypeslug') && $app['request']->get('id')) {
$handler->setPrefix("/".$app['request']->get('contenttypeslug')."/".$app['request']->get('id'));
}
View CustomUploadProvider.php
$app['upload'] = $app->share(
$app->extend(
'upload',
function ($upload, $app) {
$upload->setSanitizerCallback(
function ($filename) use () {
// do custom sanitising here...
}
);
View ReplaceCKEdit.js
var CKEDITORPluginExtras = false;
if (typeof(CKEDITOR) != 'undefined' ) {
CKEDITOR.on('instanceReady',function(event, instance){
if (CKEDITORPluginExtras) {
return;
}
var config = event.editor.config;
CKEDITOR.instances.body.destroy();
@rossriley
rossriley / gist:bb16ea1b7933292a12a4
Created Apr 9, 2015
How to adjust upload size by contenttype
View gist:bb16ea1b7933292a12a4
$app->initialize();
$app['upload'] = $app->extend('upload', function ($handler, $app) {
if ($app['request']->get('contenttype') == 'pages') {
$handler->addRule('size', ['size' => '100K'], '{label} uploads are limited to {size}', 'Page Image');
}
return $handler;
});
$app->run();
@erikflowers
erikflowers / fixed-screen-layered-background.less
Last active Jan 31, 2019
A Less mixin for layering 2 images in a background, and using "background-cover" so the bottom layer is always full size. Good for scrolling fixed backgrounds where you want a screen or other element on top. Here's a 2x2 pixel grid to get you started: http://www.helloerik.com/downloads/grid.png.zip See an example here:
View fixed-screen-layered-background.less
.background-layers(@top, @bottom) {
background: url(@top), url(@bottom);
background-position: top center, top center;
background-attachment: fixed, fixed;
background-repeat: repeat, repeat;
-webkit-background-size: auto, cover;
-moz-background-size: auto, cover;
-o-background-size: auto, cover;
background-size: auto, cover;
}
@lavoiesl
lavoiesl / .htaccess
Created Nov 21, 2012
Automatically compile LESS files
View .htaccess
# LESS compiler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} ^(.*)\.css
RewriteCond %1.less -f
RewriteRule ^(.*)\.css lessphp/less.php?f=$1.less
@LeVM
LeVM / Default (OSX).sublime-keymap
Created Sep 27, 2012
Sublime Text 2 - View in multiple broswers
View Default (OSX).sublime-keymap
{ "keys": ["alt+1"], "command": "open_browser", "args": {"keyPressed": "1"} },
{ "keys": ["alt+2"], "command": "open_browser", "args": {"keyPressed": "2"} },
{ "keys": ["alt+3"], "command": "open_browser", "args": {"keyPressed": "3"} },
{ "keys": ["alt+4"], "command": "open_browser", "args": {"keyPressed": "4"} }
@g3d
g3d / gist:2709563
Last active May 15, 2019 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
You can’t perform that action at this time.