Skip to content

Instantly share code, notes, and snippets.

Emmanuel Mwangi cloudbring

  • Santa Monica, CA
Block or report user

Report or block cloudbring

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View unapply.scala
// The unapply method of this object takes a string and returns an Option[String]
//   This means that the value being matched must be a string and the value extracted is also a string
scala> object SingleParamExtractor {
     | def unapply(v:String):Option[String] =if(v.contains("Hello")) Some("Hello") elseNone
     | }
defined module SingleParamExtractor
// this Will match since the extractor will return a Some object
scala>"Hello World"match { caseSingleParamExtractor(v) => println(v) }
Hello
// this will not match and therefore an exception will be thrown
View .spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
View snippet.rb
<%= form_tag search_movies_path, :method => 'get', class: "navbar-form", role: "search" do %>
<%= text_field_tag :search, params[:search], class: "form-control" %>
<%= submit_tag "Search", name: nil, class: "btn btn-default" %>
# I needed a search method in the corresponding movies controller.rb
def search
@movies = Movie.search(params[:search])
end
@cloudbring
cloudbring / README.md
Last active May 1, 2017
Building an Phoenix / Elixir Web App in June 2015
View README.md
View local-selenium.md
$ brew install selenium-server-standalone chromedriver
$ git clone git@github.com:theintern/intern.git
$ cd intern
$ npm install --production
$ ln -s .. node_modules/intern
$ curl https://gist.github.com/neonstalwart/6630466/raw/f0e4e4efbefa40c746f7c68e2bb4fa0dd5215047/selftest.local.intern.js > tests/selftest.local.intern.js
$ java -jar /usr/local/opt/selenium-server-standalone/selenium-server-standalone-2.35.0.jar -p 4444 &
$ node node_modules/intern/runner.js config=tests/selftest.local.intern
View designer.html
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
View hp_header.html
<!DOCTYPE html>
<html lang="en" dir="ltr" class="js"><head profile="http://www.w3.org/1999/xhtml/vocab">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link type="image/vnd.microsoft.icon" href="http://hpcloud.com/sites/default/themes/hp_cloud_base_theme/favicon.ico" rel="shortcut icon">
<link href="/node/5" rel="shortlink">
<link href="/contact_us" rel="canonical">
<meta content="Drupal 7 (http://drupal.org)" name="Generator">
<title>Contact Us | HP Cloud Services</title>
<!--[if lt IE 9]>
<script src="/sites/default/themes/hp_cloud_base_theme/js/html5.js?lzdyrv"></script>
@cloudbring
cloudbring / .rvmrc
Created Dec 20, 2011 — forked from sr/Gemfile
Janky on Heroku
View .rvmrc
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.2-p290@jankd"
#
# Uncomment following line if you want options to be set only for given project.
@cloudbring
cloudbring / cmdline
Created Dec 8, 2011
Capybara + Cucumber + Padrino config issue
View cmdline
± |t4 ✗| → padrino rake spec --trace
=> Executing Rake spec --trace ...
** Invoke spec (first_time)
** Invoke spec:models (first_time)
** Execute spec:models
/Users/e/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -S rspec -fs --color ./spec/models/repository_spec.rb
/Users/e/.rvm/gems/ruby-1.9.2-p290@tyrone/gems/capybara-1.1.2/lib/capybara/cucumber.rb:6:in `<top (required)>': undefined method `World' for main:Object (NoMethodError)
from /Users/e/work/sg/t4/spec/spec_helper.rb:15:in `require'
from /Users/e/work/sg/t4/spec/spec_helper.rb:15:in `block in <top (required)>'
from /Users/e/.rvm/gems/ruby-1.9.2-p290@tyrone/gems/spork-0.9.0.rc9/lib/spork.rb:24:in `prefork'
View app.rb
# register Padrino::Admin::AccessControl
# set :login_page, "/"
# access_control.roles_for :any do |role|
# role.protect "/profile"
# # role.protect "/admin" # Here a demo path
# end
# # Adding a role for users
You can’t perform that action at this time.