Skip to content

Instantly share code, notes, and snippets.

View omarismail's full-sized avatar

Omar Ismail omarismail

  • HashiCorp
View GitHub Profile
big_hash = {
:random_key => [
1, 2, "three", {
:foo => "bar",
:bar => "foo"
}
],
:another_key => 2,
:yet_another => {
:lorem => {
@omarismail
omarismail / gist:032871359191198f35ac
Last active August 29, 2015 14:14
Traversing down a notebook tree
getTreeData: function() {
var rootNotebooks = this.get('rootNodes');
var data = [];
rootNotebooks.forEach(function(notebook) {
var currentNotebook = notebook;
var dataObj = Ember.Object.create({
'text': currentNotebook.get('title'),
'state' : {'opened' : false, 'selected' : false },
'children': []
});
@omarismail
omarismail / search.js
Last active August 29, 2015 14:10 — forked from poteto/search.js
// utils/computed/search.js
import Ember from 'ember';
var computed = Ember.computed;
export default function search(dependentKey, propertyKey, searchQueryKey, returnEmptyArray) {
returnEmptyArray = (typeof returnEmptyArray === "undefined") ? false : returnEmptyArray;
return computed("" + dependentKey + ".@each." + propertyKey, searchQueryKey, function() {
var items, query;
if (returnEmptyArray && !this.get(searchQueryKey)) {
return Ember.A([]);

Capybara

save_and_open_page

Matchers

have_button(locator)
function rails_pg() {
rails new $1 -T --database=postgresql &&
cd $1 &&
echo $1 > .ruby-gemset &&
echo 2.0 > .ruby-version &&
echo /config/database.yml >> .gitignore &&
cp config/database.yml config/database.example.yml &&
add_rails_gems &&
function rails_pg() {
rails new $1 -T --database=postgresql &&
cd $1 &&
echo $1 > .ruby-gemset &&
echo 2.0 > .ruby-version &&
echo /config/database.yml >> .gitignore &&
cp config/database.yml config/database.example.yml &&
add_rails_gems &&