Skip to content

Instantly share code, notes, and snippets.

@andrzejsliwa
andrzejsliwa / gist:778535
Created January 13, 2011 20:29
list all available cucumber steps - (rake cucumber:steps)
# based on http://www.natontesting.com/2010/01/11/updated-script-to-list-all-cucumber-step-definitions/
#
desc 'List all defined steps'
task :steps do
require 'hirb'
extend Hirb::Console
puts "CUCUMBER steps:"
puts ""
step_definition_dir = "features/step_definitions"
@pascalduez
pascalduez / html.tpl.php
Created December 1, 2011 16:47
Drupal 7 — Move $scripts at page bottom
<!DOCTYPE html>
<html<?php print $html_attributes; ?>>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $head_scripts; ?>
</head>
<body<?php print $body_attributes;?>>
@mgraupner
mgraupner / gist:1859298
Last active September 30, 2015 20:47
MacOS X 10.7.3 and XCode 4.3: Installing Ruby, Gem and Rails
Made an update covering Macos 10.8 and ruby 2.0: https://gist.github.com/michaelsd/5224456
- Install "Command Line Tools for XCode" (Get it from Apple Developer Program) or Install XCode via Appstore
where option one is the faster one, 170MB vs 1.xGB
- Install https://github.com/sstephenson/rbenv
git clone into your home folder;
set environment variables, see install docs of rbenv;
- Get libyaml
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active June 13, 2024 02:39
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@lkptrzk
lkptrzk / 404-check.sh
Last active April 29, 2022 22:18
Script to test for 404s
#!/bin/sh
# 404-check.sh - Script to test for 404s
# author: lkptrzk
# Usage:
# Assuming a file named 'input' with one URL per line
# the following command will output which files were 404s:
# cat input | xargs 404-check.sh
@vquaiato
vquaiato / 01. Gemfile
Created September 13, 2012 04:08 — forked from schleg/01. Gemfile
Setup for Devise + Omniauth (mongoid and facebook-only)
#add this to your gemfile
gem 'mongoid'
gem 'devise'
gem "omniauth-facebook"
@jrmoran
jrmoran / app.js
Created October 23, 2012 12:50
AngularJS - basic async request
var App = angular.module('App', []);
App.controller('TodoCtrl', function($scope, $http) {
$http.get('todos.json')
.then(function(res){
$scope.todos = res.data;
});
});
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@braidn
braidn / scorched.rb
Last active December 15, 2015 08:39
just playing with a little / new framework
class MyApp < Scorched::Controller
render_defaults.merge!(
engine: :haml,
layout: :index
)
#redirect after a 404 error
after status:404 do
redirect('/')
end
middleware << proc {