Skip to content

Instantly share code, notes, and snippets.

View nicholasruunu's full-sized avatar

Nicholas Ruunu nicholasruunu

View GitHub Profile
<?php
namespace Memory\PlayingField;
use Memory\PlayingField;
final class IncompletePlayingField
{
private $cards = array();
private $numberOfCards = 0;
final class DatabaseName implements Name {
private $db;
private $table;
public function __construct(Database $db, string $table) {
$this->db = $db;
$this->table = $table;
}
public function rename($name) {
// Immutable class
class Person {
private $name;
public function __construct(string $name) {
$this->name = new Name($name);
}
public function rename(string $name) {
$this->name->rename($name);
if ( ! function_exists('dd'))
{
/**
* Dump the passed variables and end the script.
*
* @param mixed
* @return void
*/
function dd()
{
// Add arrows for extra navigation
$arrowContainer = $('<div class="arrow-container"/>')
.append($('<i class="fa fa-arrow-left"/>'))
.append($('<i class="fa fa-arrow-right"/>'));
var $arrowContainerClone = $arrowContainer.clone();
$imageContainer.append($arrowContainer);
$largePreviewImageContainer.append($arrowContainerClone);
$arrowContainer = $arrowContainer.add($arrowContainerClone);

Instructions

  • Install stud $ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
  • Download and install the powssl script $ curl https://raw.github.com/gist/2050941/3ea59efe8c7e9013c265313045a9fdda5c653963/powssl > ~/bin/powssl $ chmod +x ~/bin/powssl
  • Run powssl to create development certificate and configure stud.
  • $ powssl
@nicholasruunu
nicholasruunu / webform-form.tpl.php
Last active December 20, 2015 19:29
Removing unnecessary check and shortening the code.
<?php
foreach ($form['submitted'] as &$value) {
$types = array('textfield', 'webform_email', 'textarea');
if (isset($value['#type']) && in_array($value['#type'], $types)) {
$value['#attributes']['placeholder'] = $value['#title'];
}
}
@nicholasruunu
nicholasruunu / gist:5704893
Last active December 18, 2015 01:39
jQuery Help
<!DOCTYPE HTML>
<html>
<head>
<meta name="author" content="Johnie Hjelm">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="stylesheet" type="text/css" href="style.css">
@nicholasruunu
nicholasruunu / color-shader.js
Last active December 15, 2015 14:49 — forked from jonathanmarvens/color-shader.js
Made it a little more DRY
/**
* @author Jonathan Barronville
* @example
* var color_001 = colorShader( '000000', 255 );
* // color_001 === 'ffffff';
* var color_002 = colorShader( 'ffffff', -255 );
* // color_002 === '000000';
* @param {String} color_hex
* @param {Number} amount
* @return {String}
@nicholasruunu
nicholasruunu / jpholdr.js
Created November 2, 2011 15:04
jPholdr, Ultra Lightweight Placeholder Plugin for jQuery
/**
* jPholdr
* Ultra Lightweight Placeholder Plugin for jQuery
*
* @author: Nicholas Ruunu
* @email: [email protected]
* @website: http://ruu.nu
*
* Example: $('#form').jPholdr();
*/