This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
OlderNewer