Skip to content

Instantly share code, notes, and snippets.

View JaisonBrooks's full-sized avatar

Jaison Brooks JaisonBrooks

  • Enphase Energy
  • Boise, ID
View GitHub Profile
package your.package;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.graphics.Palette;
import com.squareup.picasso.Picasso;
import your.package.PaletteTransformation;
import static your.package.PaletteTransformation.PaletteCallback;
package your.package;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.graphics.Palette;
import com.squareup.picasso.Picasso;
import your.package.PaletteTransformation;
import static your.package.PaletteTransformation.PaletteCallback;
@JaisonBrooks
JaisonBrooks / 01newrelic.config
Last active January 6, 2022 13:53
AWS Elastic beanstalk (PHP) config file for installing and setting up the NewRelic agent
packages:
rpm:
newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
yum:
newrelic-php5: []
newrelic-sysmond: []
commands:
"01":
command: newrelic-install install
@JaisonBrooks
JaisonBrooks / example.rb
Last active September 10, 2015 21:49 — forked from erikeldridge/example.rb
A utility for signing an url using OAuth in a way that's convenient for debugging
require 'oauth_util.rb'
require 'net/http'
o = OauthUtil.new
o.consumer_key = 'examplek9SGJUTUpocjZ5QjBJmQ9WVdrOVVFNHdSR2x1TkhFbWNHbzlNQS0tJnM9Y29uc3VtkZXJzZWNyZXQmeD0yYg--';
o.consumer_secret = 'exampled88d4109c63e778dsadcdd5c1875814977';
url = 'http://query.yahooapis.com/v1/yql?q=select%20*%20from%20social.updates.search%20where%20query%3D%22search%20terms%22&diagnostics=true';
@JaisonBrooks
JaisonBrooks / split_and_replace_to_array.rb
Created September 10, 2015 22:24
Split and extract pieces of a string into an array, only leaving what you need
# I have the following string and needed to extract just the values from it.
# Thus removing the key and =/& symbols and return the values in an array
#
# I did it like so.
str = "str1=lolf839Di8FjliWBfcceBab8PvD9AuqY1b7ISjVL43XeOh7yaUA&str2=OAW8mb1x7lEl0s5OUCz7vdZtMVzYXI9j8IYkxhKfCbQ"
str.split('&').each{|b| b.gsub!(/.*?=(?=)/im, "")}
# > ["lolf839Di8FjliWBfcceBab8PvD9AuqY1b7ISjVL43XeOh7yaUA", "OAW8mb1x7lEl0s5OUCz7vdZtMVzYXI9j8IYkxhKfCbQ"]
@JaisonBrooks
JaisonBrooks / Capistrano 3.md
Last active September 16, 2015 19:32 — forked from stevenyap/Capistrano 3.md
Capistrano 3 Setup

This guide explains the way to setup a production server using Capistrano.

Setup Capistrano on LOCAL

  • Capistrano is a development gem which assist the developer to run commands on the production server (something like a Heroku toolbelt)
  • Hence, it is installed and configured on developer's computer
# Gemfile

# Use Capistrano for deployment
@JaisonBrooks
JaisonBrooks / install_spigot.sh
Last active September 18, 2015 03:51
Install the Spigot Minecraft server via command line | Checkout => www.spigotmc.org and http://getspigot.org/ for more details.
# Make sure you have java 7+, git and a beer cause its going to be awhile :) #
wget http://getspigot.org/build.sh && sudo bash build.sh
@JaisonBrooks
JaisonBrooks / getting_started.md
Created December 10, 2015 15:07 — forked from boddhisattva/getting_started.md
Writing a spec from scratch for a plain ruby script(no rails) using TDD

Steps -

  • Create the filename.rb file for which you’d like to create a filename_spec.rb
  • Run the command rspec --init from the same working directory as to where you have filename.rb
  • the above command will create a .rspec file for you
  • It will create a new spec directory within which you need to place your specs
  • It will create spec_helper.rb where you need continually require the ruby files that you would want to write specs for
  • Create the filename_spec.rb within the spec directory
  • [optional] Edit the .rspec file to add the option: --format documentation
  • The above addition gives your running tests more readability as to what they do or what they stand for when they are run.
@JaisonBrooks
JaisonBrooks / random_hex_colors.rb
Last active December 16, 2015 21:51
Generate random hex colors in ruby
```
255.times { puts '#%06x'%(rand*0xffffff) }
```
#3df5bd
#55e6a6
#52c4e4
#c5fc45
#07debb
#3a29eb
#e7a501
@JaisonBrooks
JaisonBrooks / application.html.erb
Created January 26, 2016 23:24 — forked from suryart/application.html.erb
Rails 4 flash messages using Twitter Bootstrap(bootstrap-sass: https://github.com/thomas-mcdonald/bootstrap-sass). An improved version of https://gist.github.com/roberto/3344628
// layout file
<body>
<div class="container">
<%= flash_messages %>
<%= yield %>
</div><!-- /container -->
</body>