Skip to content

Instantly share code, notes, and snippets.

View shakyShane's full-sized avatar

Shane Osbourne shakyShane

View GitHub Profile
@shakyShane
shakyShane / base.php
Created July 22, 2012 09:36
boilerplate for a Laravel Base Controller
<?php
class Base_Controller extends Controller {
public $layout = 'layouts.main';
public function __construct(){
//Styles
Asset::add('css', 'css/main.css');
@shakyShane
shakyShane / html5-number-polyfill.html
Created November 7, 2012 19:23
Increment/Decrement an 'amount' input.
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
</head>
<body>
var bs = require('browser-sync').create();
var router = require("express").Router();
/**
* Helper for send a JSON resp
*/
function jsonResp(res, obj) {
res.setHeader("content-type", "application/json");
res.end(JSON.stringify(obj));
}

config-gen

Generate RequireJS Optimizer configuration for Magento 2 website based on real-world usage.

Step 1 - Download the binary

config-gen is packaged as a single binary (currently only osx) to enable easy usage, just check the releases page and download the latest.

config-gen

Generate RequireJS Optimizer configuration for Magento 2 website.

Step 1 - Download the binary

config-gen is packaged as a single binary (currently only osx) to enable easy usage, just check the releases page and download the latest.

@shakyShane
shakyShane / BootstrapForm.php
Created August 5, 2012 18:47
Twitter Bootstrap Form Generator PHP.
<?php
/**
*
* Helper Class to output correct Twitter Bootstrap Markup.
* Only option for now is the horizontal Form.
*
* Usage :
*
$form = new BootstrapForm('add_user');
$form->addInput('text-input', 'user_name', 'Your name:', true);
struct AppState {
config: Arc<Mutext<Vec<String>>>
}
///
/// these handlers can be running on any number of threads
///
fn handler(req: &HttpRequest<AppState>) -> Box<Future<Item = HttpResponse, Error = ()>> {
// clone the Arc here so it can be safely moved into the closure
impl M2PresetOptions {
pub fn get_opts(prog_config: ProgramConfig) -> Option<M2PresetOptions> {
serde_yaml::from_value(prog_config.get_opts("m2")?).ok()?
}
}
///
/// A simple way to apply both a predicate
/// and default value when dealing with an option.
///
fn is_legal(age: Option<usize>) -> bool {
age.map(|x| x >= 18).unwrap_or(false)
}
version: '2'
services:
nginx:
volumes:
- .docker/certs:/etc/letsencrypt
env_file:
- ./.docker/local.env
php: