Skip to content

Instantly share code, notes, and snippets.

View steampilot's full-sized avatar

Jérôme Röthlisberger steampilot

View GitHub Profile
@steampilot
steampilot / CakePHPCustomFormHelper.php
Last active March 7, 2017 08:48
How to implement custom styled checkbox inputs in CakePHP 2.x by extending the input method of BoostCakeFormHelper
<?php
App::uses('BoostCakeFormHelper', 'BoostCake.View/Helper');
/**
* Class CustomFormHelper
*
*/
class CustomFormHelper extends BoostCakeFormHelper {
public $helpers = array('Form' => array(
'className' => 'BoostCake.BoostCakeForm',
@steampilot
steampilot / Bootstrap Collapse Indicator
Created March 1, 2017 15:13
It shows how to formatt the collapse indicator icon according tho the state of the collapsed element
<!DOCTYPE html>
<html>
<head>
<style>
.icon.icon-collapse-arrow,
.collapse-control[aria-expanded="false"] > .icon.icon-collapse-arrow,
.collapse-control[aria-expanded="true"] > .icon.icon-collapse-arrow {
padding: 5px 8px;
margin-right: 8px;
background-image: url("../img/icons/arrow-down.png");
@steampilot
steampilot / README.md
Created August 25, 2016 18:18 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@steampilot
steampilot / php interpolate
Created September 24, 2014 07:46
Interpolate
/**
* Interpolates context values into the message placeholders.
*/
function interpolate($message, array $context = array())
{
// build a replacement array with braces around the context keys
$replace = array();
foreach ($context as $key => $val) {
$replace['{' . $key . '}'] = $val;
}
@steampilot
steampilot / gist:57d59d4080b5d863487c
Created September 20, 2014 14:28
PHP dynamic class and function call
$class ='Foo';
$function = 'bar'
$object = new $class();
$object->$function();
class Foo {
public function bar() {
echo 'Class Foo responds with function bar';
}
@steampilot
steampilot / gist:7e49f354bde82715a42f
Created September 10, 2014 22:09
Css Icon Implementation
<div class="service-item">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-cloud fa-stack-1x text-primary"></i>
</span>
<h4>
<strong>SPWR - Weather Report</strong>
</h4>
<p>Creating Weather Maps with the use of GD Library</p>
<a target="_top" href="spwr/" class="btn btn-light">SPWR</a>