An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
| import Foundation | |
| let config = NSURLSessionConfiguration.defaultSessionConfiguration() | |
| let userPasswordString = "[email protected]:password" | |
| let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding) | |
| let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil) | |
| let authString = "Basic \(base64EncodedCredential)" | |
| config.HTTPAdditionalHeaders = ["Authorization" : authString] | |
| let session = NSURLSession(configuration: config) |
| .DS_Store | |
| node_modules |
| def color(text, **user_styles): | |
| styles = { | |
| # styles | |
| 'reset': '\033[0m', | |
| 'bold': '\033[01m', | |
| 'disabled': '\033[02m', | |
| 'underline': '\033[04m', | |
| 'reverse': '\033[07m', |
| // Here’s a 100% deterministic alternative to `Math.random`. Google’s V8 and | |
| // Octane benchmark suites use this to ensure predictable results. | |
| Math.random = (function() { | |
| var seed = 0x2F6E2B1; | |
| return function() { | |
| // Robert Jenkins’ 32 bit integer hash function | |
| seed = ((seed + 0x7ED55D16) + (seed << 12)) & 0xFFFFFFFF; | |
| seed = ((seed ^ 0xC761C23C) ^ (seed >>> 19)) & 0xFFFFFFFF; | |
| seed = ((seed + 0x165667B1) + (seed << 5)) & 0xFFFFFFFF; |
| #!/bin/bash | |
| if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF | |
| appify v3.0.1 for Mac OS X - http://mths.be/appify | |
| Creates the simplest possible Mac app from a shell script. | |
| Appify takes a shell script as its first argument: | |
| `basename "$0"` my-script.sh |
| { | |
| // -------------------------------------------------------------------- | |
| // JSHint Configuration, Strict Edition | |
| // -------------------------------------------------------------------- | |
| // | |
| // This is a options template for [JSHint][1], using [JSHint example][2] | |
| // and [Ory Band's example][3] as basis and setting config values to | |
| // be most strict: | |
| // | |
| // * set all enforcing options to true |
| #!/usr/bin/env bash | |
| # | |
| # url : https://gist.github.com/672684 | |
| # version : 2.0.2 | |
| # name : appify | |
| # description : Create the simplest possible mac app from a shell script. | |
| # usage : cat my-script.sh | appify MyApp | |
| # platform : Mac OS X | |
| # author : Thomas Aylott <[email protected]> |
| (function addXhrProgressEvent($) { | |
| var originalXhr = $.ajaxSettings.xhr; | |
| $.ajaxSetup({ | |
| progress: function() { console.log("standard progress callback"); }, | |
| xhr: function() { | |
| var req = originalXhr(), that = this; | |
| if (req) { | |
| if (typeof req.addEventListener == "function") { | |
| req.addEventListener("progress", function(evt) { | |
| that.progress(evt); |
| from django import http | |
| from django.conf import settings | |
| """ | |
| Put this file in a directory called, eg, 'middleware,' inside your django | |
| project. Make sure to create an __init__.py file in the directory so it can | |
| be included as a module. | |
| Set the values for | |
| XS_SHARING_ALLOWED_ORIGINS | |
| XS_SHARING_ALLOWED_METHODS |