Skip to content

Instantly share code, notes, and snippets.

View steadweb's full-sized avatar

Luke Steadman steadweb

View GitHub Profile
@steadweb
steadweb / gist:5063257
Created March 1, 2013 08:29
LESS ant build script.
<?xml version="1.0" ?>
<project default="default" basedir=".">
<target name="default" depends="init, less" />
<target name="init">
<echo>-- Initialize Variables</echo>
<property name="less.path" value="httpdocs/assets/less" />
<echo message="less.path: ${less.path}" />
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@steadweb
steadweb / gist:9652113
Created March 19, 2014 21:47
handy git lg
git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
@steadweb
steadweb / myproduct.php
Created May 14, 2014 08:27
Custom indexer which combines fields into one (example)
<?php
// put into fuel/app/classes/elasticsearch
namespace Elasticsearch;
class Index_MyProduct extends Index_Product
{
protected static function _get_products_full_fields() {
$fields = parent::_get_products_full_fields();
@steadweb
steadweb / gist:3cae261ec7648164d618
Created September 30, 2014 13:17
Basic L4 .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|bmp|mov|mp4|mp3)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

What do you know about hashes?

#####(1) Instantiate a hash in two ways.

# your code here

#####(2)

What do you know about Comparators and Booleans?

#####(1) Given the following array of integers, for each number, print the numbers less than the number in question. For example, given this array:

nums = [1,2,3]

We should see this output:

What do you know about Iteration / Enumeration?

#####(1) Given the following array, use each to enumerate over it, using puts to print this sentence to the console for each element: [THE_NAME] is Mario Batali's fancy [THE_CUISINE] joint.

arr = [
  {name: 'Babbo', cuisine: 'high-priced italian'},
  {name: 'Del Posto', cuisine: 'higher-priced italian'},
  {name: 'Eataly', cuisine: 'disney world of an italian market'},

(1) Create a hash with the following key value pairs

key value
red green
yellow purple
blue orange

What do you know about Sinatra?

(1) Implement code that satisifes the following request / response pattern.

# request: GET '/matt'
# response: "Hello matt.  Do you mind if I call you ttam?"

# your code here