Skip to content

Instantly share code, notes, and snippets.

equire 'test_helper'
class CartsControllerTest < ActionDispatch::IntegrationTest
setup do
@cart = carts(:one)
end
test "should get index" do
get carts_url
assert_response :success
@rubys
rubys / PushEvent.py
Last active September 23, 2018 20:41
Allow git-multimail to run as a webhook for GitHub
#!/usr/bin/python
from __future__ import print_function
#
# A simple CGI script useful for debugging GitHub web hooks
# https://developer.github.com/webhooks/
#
import hashlib, hmac, json, os, sys, traceback
from subprocess import Popen, PIPE, STDOUT
require 'wunderbar/sinatra'
require 'wunderbar/react'
require 'ruby2js/filter/functions'
get '/' do
_html do
_div.worklist!
_script do
docTypes = %w(icla grant ccla nda other)
docTypes = %w(icla grant ccla nda other)
class DocumentForm < React
def getInitialState()
end
def handleDocTypeChange(event)
var type = event.target.value;
end
require 'mail'
require 'zlib'
require 'zip'
require 'yaml'
require 'stringio'
def file_list(contents, command)
file = Tempfile.new('parsemail')
file.write(contents)
file.close
require 'ruby2js/filter/functions'
gist = 'https://gist.github.com/mnot/138549'
uri_validate = '/home/rubys/tmp/uri_validate.py'
# fetch gist, if necessary
if not File.exist? uri_validate
require 'nokogumbo'
raw = Nokogiri::HTML5.get(gist).at('a[aria-label="View Raw"]')['href']
Dir.chdir File.dirname(uri_validate) do
system "wget -O #{uri_validate} #{URI.parse(gist)+raw}"
{
"accessibilityinindia": 0,
"infographics": 0,
"svga11y": 1,
"activitypub": 0,
"adopsdnt": 0,
"coders4africa": 13,
"agelabels": 0,
"agri": 0,
"model": 0,
require 'nokogumbo'
require 'date'
require 'json'
start = Date.today - 105
results = {}
index = 'http://www.w3.org/community/groups/'
groups = Nokogiri::HTML5.get(index)
groups = groups.search('a.h3').map {|a| a['href'].sub(/^#/, '')}
require 'nokogumbo'
require 'date'
require 'json'
start = Date.today - 105
results = {}
index = 'http://www.w3.org/community/groups/'
groups = Nokogiri::HTML5.get(index)
groups = groups.search('a.h3').map {|a| a['href'].sub(/^#/, '')}
{
"accessibilityinindia": 0,
"infographics": 0,
"svga11y": 1,
"activitypub": 0,
"adopsdnt": 0,
"coders4africa": 13,
"agelabels": 0,
"agri": 0,
"model": 0,