This file contains hidden or 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 Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var http = new HttpRequest("http://google.com/?q={search}"); | |
| http.Headers["Content-Type"] = "text/xml"; | |
| http.Headers.Authorization = "foo"; | |
| http.UrlSegments.search = "bar"; | |
This file contains hidden or 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
| // using Twilio; | |
| // var twilio = new TwilioRestClient("accountSid", "authToken"); | |
| // var msg = twilio.SendSmsMessage("+15551112222", "+15553334444", "Can you believe it's this easy to send an SMS?!"); | |
| [System.Reflection.Assembly]::LoadFile("Twilio.Api.dll") | out-null | |
| $twilio = new-object Twilio.TwilioRestClient("accountSid", "authToken") | |
| $msg = $twilio.SendSmsMessage("+15551112222", "+15553334444", "Can you believe it's this easy to send an SMS?!") | |
| // v2 | |
| Add-Type -path "Twilio.Api.dll" |
This file contains hidden or 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
| from functools import wraps | |
| from flask import request, redirect | |
| import os | |
| def https_required(f): | |
| @wraps(f) | |
| def decorated_function(*args, **kwargs): | |
| scheme = 'http' | |
| if request.headers.get('x-forwarded-proto', None): | |
| scheme = request.headers.get('x-forwarded-proto') |
This file contains hidden or 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
| TWITTER_CONSUMER_KEY = '...' | |
| TWITTER_CONSUMER_SECRET = '...' | |
| TWITTER_ACCESS_TOKEN = '...' | |
| TWITTER_TOKEN_SECRET = '...' | |
| SENDGRID_USER = '...' | |
| SENDGRID_KEY = '...' | |
| STRIPE_SECRET_KEY = '...' |
This file contains hidden or 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 Command: | |
| m = '' | |
| r = '' | |
| resources = { | |
| 'promo-codes' : { | |
| 'POST' : post_promo_code, | |
| 'DELETE' : delete_promo_code | |
| }, | |
| 'approved-jobs' : { |
This file contains hidden or 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
| @app.route('/xyzzy/ajax/<resource>', methods=['POST', 'GET', 'DELETE']) | |
| @auth.required | |
| @https_required | |
| def admin_ajax(resource): | |
| cmd = Command(request.method, resource) | |
| # could replace this with data = request.params | |
| data = request.args | |
| if (request.method in ['PUT', 'POST']): | |
| data = request.form |
This file contains hidden or 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
| public static partial class RestClientExtensions | |
| { | |
| public static RestResponse<dynamic> ExecuteDynamic(this IRestClient client, IRestRequest request) | |
| { | |
| var response = client.Execute(request); | |
| var generic = (RestResponse<dynamic>)response; | |
| dynamic content = SimpleJson.DeserializeObject(response.Content); | |
| generic.Data = content; |
This file contains hidden or 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
| import sys | |
| import bitly_api | |
| import os | |
| from config import config | |
| # sign up for a free account at runscope.com and make | |
| # note of your bucket key | |
| # connect to bitly | |
| conn_btly = bitly_api.Connection(access_token=config['ACCESS_TOKEN']) |
This file contains hidden or 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
| import sys | |
| import bitly_api | |
| import os | |
| from config import config | |
| # sign up for a free account at runscope.com and make | |
| # note of your bucket key | |
| # connect to bitly | |
| conn_btly = bitly_api.Connection(access_token=config['ACCESS_TOKEN']) |
This file contains hidden or 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
| ### Keybase proof | |
| I hereby claim: | |
| * I am johnsheehan on github. | |
| * I am johnsheehan (https://keybase.io/johnsheehan) on keybase. | |
| * I have a public key whose fingerprint is 701C 7D09 54E6 82F3 8007 479A C03D CEDB A3CC 6812 | |
| To claim this, I am signing this object: |