Skip to content

Instantly share code, notes, and snippets.

View kerinin's full-sized avatar

Ryan Michael kerinin

View GitHub Profile
class DevelopersController < ApplicationController
respond_to :hal
FILTERS = {
:created_since => ->(p,d) {d.where(:created_at.gte => p.to_i)},
:last_activity_since => ->(p,d) {d.with_last_activity_after(p)},
:email_address => ->(p,d) {d.where(email_address: p)},
:api_key => ->(p,d) {d.where(api_key: p)}
}
def get_message_infos_after_date(ymail_folder, last_date)
messages = []
oldest_found = Time.now.to_i
last_date = last_date.to_i
offset = 0
while oldest_found > last_date
hash = self.request('ListMessages', :fid => ymail_folder.fid, :sortKey => "date", :sortOrder => "down",
:startInfo => offset, :startMid => offset, :numInfo => 100, :numMid => 100)
found_messages = hash['result']['messageInfo'].map{|h| Ymail::YmailApi::DataTypes::MessageInfo.make_from_hash(h,ymail_folder)}
messages.push(*found_messages)
set default_parallel 92;
read_rate_records = LOAD 's3://oib-mapreduce/output/folder_scan_rollups/2013/06/2013-02-15' AS (
scanned_at:chararray,
received_at:chararray,
mm_id,
source:chararray,
folder:chararray,
read,
subject:chararray,
set default_parallel 12;
sls_watchlist = LOAD 's3://oib-mapreduce-rmichael/sls_watchlist_dumps' AS (
domain: chararray,
subject_line: chararray,
campaign_group: chararray,
mail_campaign_id: chararray,
hour: int
);
context "current user exists, user is not currently using this application" do
# Redirects to Application > Email Addresses, prompts to activate application
end
context "current user exists, user is currently using this application" do
# Redirects to Application > (root)
end
context "no current user, EEA doesn't exist (8L)" do
# Redirects to account_to_found
void set_color(int color, int redPin, int greenPin)
{
int centrality = abs(128 - color);
int augmentation = floor((128 - centrality) / 5);
analogWrite(redPin, color+augmentation);
analogWrite(greenPin, 255-color+augmentation);
}
@kerinin
kerinin / stat.ino
Created December 6, 2012 19:48
Parsing Graphite Response
#include <Arduino.h>
String resp;
void setup() {
Serial.begin(9600);
Serial.write("\r\n");
Serial.println("-----------------------");
Serial.println("Arduino Context.IO demo");
@kerinin
kerinin / gist:4226126
Created December 6, 2012 17:06
HTTP response
/* Handle content. */
while (http.connected())
{
while (http.available() > 0)
{
uint8_t byte = http.read();
if (!success)
Serial.write(byte);
@kerinin
kerinin / gist:4068172
Created November 13, 2012 20:28
Conditional organization
# Option 1
if eea_exists?
if eea_uses_something?
if eea_ever_used_application?
if eea_currently_uses_application?
recreate_eea; reactivate_application_for_eea; create_session; #13S
else
recreate_eea; reactivate_application_for_eea; create_session; #13S
end
@kerinin
kerinin / after.html
Created September 10, 2012 16:16
Muddle Example
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body style="width: 100% !important; margin: 0; padding: 0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%;">
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tbody>
<tr>
<td valign="top"><h1 style="color: black !important;">Welcome to our AWESOME NEW WEB SERVICE!</h1></td>
</tr>