Skip to content

Instantly share code, notes, and snippets.

View sha1sum's full-sized avatar

Anthony Atkinson sha1sum

  • GRIN, Inc.
  • Saint Petersburg, FL, United States
View GitHub Profile
@sha1sum
sha1sum / groupme.rb
Last active August 29, 2015 14:07
Ruby Class for Posting GroupMe Messages
class GroupMe
include HTTParty
base_uri 'https://api.groupme.com/v3'
format :json
def initialize(access_token)
@access_token = access_token
end
def doPost(path, body, query = nil)
@sha1sum
sha1sum / groupme_faye.rb
Created October 2, 2014 12:14
Rails Initializer for GroupMe Faye Sockets
# Originally set up as a Rails initializer, but can be adapted to use elsewhere.
# Requires the faye gem
require 'eventmachine'
Thread.new do
EM.run {
::GroupMeClient = Faye::Client.new 'https://push.groupme.com/faye'
class GroupMeClientAuth
@sha1sum
sha1sum / gist:c9429a4f69fea0c5637a
Last active August 29, 2015 14:09
GroupMe Emoji JS
// This gets the powerups for us to use in the below replaceEmoji function
window.powerups = (function() {
var powerups = null;
$.ajax({
'async': false,
'global': false,
'url': 'https://powerup.groupme.com/powerups',
'dataType': 'json',
'success': function(data) {
powerups = data;
@sha1sum
sha1sum / powerups.rb
Created November 13, 2014 12:47
GroupMe Powerups Initializer
powerups_url = "https://powerup.groupme.com/powerups"
unless Rails.env.test?
response = HTTParty.get(powerups_url)
if response.success?
::GroupMePowerUps = response['powerups']
else
::GroupMePowerUps = Array.new
end
else
::GroupMePowerUps = Array.new
@sha1sum
sha1sum / gist:368d6f3b4e2567b89411
Created November 13, 2014 13:08
Unicode GroupMe Emoji Replacement
function codePointAt(text, position) {
if (text == null) {
throw TypeError();
}
var string = String(text);
var size = string.length;
// `ToInteger`
var index = position ? Number(position) : 0;
if (index != index) { // better `isNaN`
index = 0;
@sha1sum
sha1sum / groupme_random_fact.php
Created December 15, 2014 20:10
Random Fact Generator for a GroupMe Bot (via callback URL)
<?php
/*
* Output a random fact to GroupMe via a bot.
*
* Trigger the bot with "!randomfact" or "!random fact".
* Enter the bot ID on line 43.
*
*/
@sha1sum
sha1sum / groupme.rb
Created February 12, 2015 16:07
Back Up a GroupMe Group's Images to a Folder
require 'uri'
require 'open-uri'
require 'fileutils'
require 'httparty'
# You will need to have HTTParty installed:
# https://github.com/jnunemaker/httparty
#
# Initialize with your access token:
# GroupMe.new('abcdefghijklmnopqrstuvwxyz')
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
........*.........................F.....FFFFF................................FFFFFFF..FF........................................................................F..........................................
Pending:
products admin user deleting product
# Not yet implemented
# ./spec/features/admin/products_spec.rb:40
update logs
set app_id = case when apps.id is not null then apps.id else 0 end
from logs l
left outer join apps
on l.app_name = apps.name
AND l.company_id = apps.company_id
class Admin::Product < ActiveRecord::Base
require 'csv'
has_attached_file :image,
styles: { medium: "500x500>",
thumb: "200x200>" },
default_url: "/images/:style/missing.jpg"
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/