Skip to content

Instantly share code, notes, and snippets.

View brianly's full-sized avatar
🦙
Don't get much time to hack right now due to 👶

Brian Lyttle brianly

🦙
Don't get much time to hack right now due to 👶
View GitHub Profile
@brianly
brianly / like.html
Created July 18, 2013 14:52
WHY NO WORK??
<!doctype html>
<html>
<head>
</head>
<body>
<script data-app-id="hyB2pTvrL36Y50py8EWj6A" src="https://assets.yammer.com/platform/yam.js"></script>
<script>
yam.connect.actionButton({
container: "#embedded-like",
network: "provinggroundtestnetwork312.com",
def exchange_check(exchange_user_email, exchange_password, yammer_user_email,ooo_message)
user_is_busy = false
user_is_ooo = false
user_is_ooo_startdate = DateTime.now.strftime("%D") # Date only
user_is_ooo_lastdate = DateTime.now.strftime("%D") # Date only
require 'net/http'
url = URI.parse('http://bl-hackday.cloudapp.net/hackday/calendar')
@brianly
brianly / gist:5797841
Created June 17, 2013 15:34
Pings and traceroutes from Northern Ireland.
vagrant :: (master*) » ping www.yammer.com ~/vm/vagrant 127 ↵
PING www.yammer.com (204.152.18.206): 56 data bytes
64 bytes from 204.152.18.206: icmp_seq=0 ttl=240 time=191.176 ms
64 bytes from 204.152.18.206: icmp_seq=1 ttl=240 time=191.060 ms
64 bytes from 204.152.18.206: icmp_seq=2 ttl=240 time=194.129 ms
64 bytes from 204.152.18.206: icmp_seq=3 ttl=240 time=201.785 ms
64 bytes from 204.152.18.206: icmp_seq=4 ttl=240 time=264.036 ms
64 bytes from 204.152.18.206: icmp_seq=5 ttl=240 time=216.519 ms
64 bytes from 204.152.18.206: icmp_seq=6 ttl=240 time=308.934 ms
64 bytes from 204.152.18.206: icmp_seq=7 ttl=240 time=339.555 ms
@brianly
brianly / put.rb
Created June 3, 2013 15:06
Code interpreted in my head for executing a PUT request to a Yammer user profile.
require 'net/http'
port = 443
host = "www.yammer.com"
path = "/api/v1/users/[:id].json"
req = Net::HTTP::Put.new(path, initheader = { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN'})
req.body = "work_telephone=01189998819991197253&work_extension=12345"
response = Net::HTTP.new(host, port).start {|http| http.request(req) }
puts response.code
@brianly
brianly / YammerClient.cs
Last active March 23, 2017 20:43
Example OAuth client for Yammer using DotNetOpenAuth. You'll need to generate some model classes with http://json2csharp.com after poking around with the API endpoints. These are needed to handle the JSON returned when the OAuth dance is finished, and when user properties are requested.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using DotNetOpenAuth.AspNet.Clients;
using DotNetOpenAuth.Messaging;
using Newtonsoft.Json;
using YammerAuthentication.Yammer.Models.User;
@brianly
brianly / gist:5644600
Created May 24, 2013 16:14
A collection of OK and bad regexs for email validation.
^(.+)@(.+)$
/.\@.*\../
/\A[^@]+@([^@\.]+\.)+[^@\.]+\z/
/^(|(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})$/i
\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b
@brianly
brianly / example.py
Created March 4, 2013 06:21
An example showing how to use an Access Token to return messages with YamPy
# -*- coding: utf-8 -*-
ACCESS_TOKEN = ''
import json
import yampy
def pprint(raw_json):
print json.dumps(raw_json, sort_keys=True,
indent=2, separators=(',', ': '))
@brianly
brianly / auth.py
Last active December 14, 2015 11:38
An example showing you how to get an Access Token with YamPy.
# -*- coding: utf-8 -*-
import os
import yampy
import webbrowser
# Configure all of these constants at https://www.yammer.com/client_applications
CLIENT_ID = ''
CLIENT_SECRET = ''
REDIRECT_URI = 'http://brianlyttle.com/yammer/'
@brianly
brianly / gist:4574309
Created January 19, 2013 18:55
Stupid WinForms example showing how to Embed a browser control and handle Yammer OAuth.
// Add these to a form:
// * Web Browser
// * Button 1 (starts the process)
// * Button 2 (outputs the current URL)
// * TextBox 1 (logs actions)
// * TextBox 2 (for the token)
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("https://www.yammer.com/dialog/oauth?client_id=SFZc9HHFXK77keEFYdXphw&redirect_uri=http://brianlyttle.com/yammer/mshtml/redirect_uri&response_type=token");
@brianly
brianly / acrylaport.py
Last active December 11, 2015 01:18
The guts of a script to convert posts from a WordPress blog export into markdown for use with Acrylamid.
import os
import codecs
import xml.etree.ElementTree as etree
from dateutil import parser as du
from urlparse import urlparse
def parse_export(path):
"""Parses the WordPress export file into a Python-native format"""