Skip to content

Instantly share code, notes, and snippets.

View drawcode's full-sized avatar
😎
Shipping product

Ryan Christensen drawcode

😎
Shipping product
View GitHub Profile
print "hello"
@drawcode
drawcode / gist:4211301
Created December 5, 2012 01:45
Python 3 Url request
import httplib2
h = httplib2.Http(".cache")
h.add_credentials('user', 'pass')
r, content = h.request("https://api.github.com", "GET")
print r['status']
print r['content-type']
@drawcode
drawcode / gist:4211303
Created December 5, 2012 01:46
Python requests request
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
r = requests.get('https://api.github.com', auth=('user', 'pass'))
print r.status_code
print r.headers['content-type']
@drawcode
drawcode / gist:4211309
Created December 5, 2012 01:47
Python urllib2 request
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@drawcode
drawcode / bucket_policy.js
Created December 10, 2012 21:38 — forked from philfreo/bucket_policy.js
AWS S3 bucket policy to make all files public (+CORS)
{
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket_name_here/*"
@drawcode
drawcode / ArrayUtil.cs
Created December 10, 2012 21:57
Unity Utils C#
using System;
using System.Collections.Generic;
public static class ArrayUtil
{
/// <summary>
/// Filter the given array into an array of a derived type
/// </summary>
/// <returns>
@drawcode
drawcode / GameObjectExtensions.cs
Created December 10, 2012 22:01
Unity Extensions C#
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using Engine.Utility;
public static class GameObjectExtensions {
public static void SetLayerRecursively(this GameObject inst, int layer) {
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class ByteArray {
private MemoryStream stream;
private BinaryWriter writer;
public ByteArray() {
@drawcode
drawcode / DataObjects.cs
Created December 16, 2012 07:24
Base file used in some Unity projects for loading items from different sources.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
#if !UNITY_WEBPLAYER
using System.Reflection;
using System.IO;
#include <string>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <algorithm>
template <class T>
inline std::string toString(const T& t)
{