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
| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| "os" | |
| "reflect" | |
| ) | |
| type Writer interface { |
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
| - endpoint | |
| for: movies | |
| that: persists new records | |
| for model: movie | |
| backed by: postgres | |
| cached by: redis | |
| - endpoint | |
| for: movies | |
| that: retrieves records |
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
| GET https://management.azure.com/subscriptions/SUBSCRIPTION_ID_REDACTED/resourceGroups/RESOURCE_GROUP_REDACTED/providers/Microsoft.Backup/BackupVault/VAULT_REDACTED/items?api-version=2014-09-01 | |
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
| SET NOCOUNT ON | |
| USE AdventureWorks | |
| GO | |
| DECLARE @loop INT | |
| DECLARE @USER sysname | |
| IF OBJECT_ID('tempdb..#Orphaned') IS NOT NULL | |
| BEGIN | |
| DROP TABLE #orphaned | |
| END |
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
| // if you want to specify a custom localtunnel subomain, just throw it in an additional argument eg: node debugWebserver.js mysubdomain | |
| var util = require("util"); | |
| var lt = require("localtunnel"); | |
| var http = require('http'); | |
| http.createServer(function (req, res) { | |
| console.log(req.method + " " + req.url) | |
| req.on("data", function(chunk) { | |
| console.log("Body: " + chunk) |
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
| #!/bin/bash | |
| ## This script requires jq (http://stedolan.github.io/jq/) and curl | |
| TAGSRESPONSE=`curl --silent -X GET -u YOURKEY:x-oauth-basic https://api.github.com/repos/yourUser/yourRepo/tags` | |
| TAG=`echo $TAGSRESPONSE | /usr/local/bin/jq '.[] | .name' | sort --reverse | head -1 | tr -d '"'` | |
| APIBODY=`echo "{ \"api_key\": \"yourKey\",\"data\": {\"item\": [{\"text\": \"${TAG}\",\"type\": 2}]}}"` | |
| echo $APIBODY > /tmp/apiBody.json | |
| curl --silent -d @/tmp/apiBody.json -X POST -H "Content-Type: application/json" 'https://push.geckoboard.com/v1/send/yourBoardId' |
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
| module.exports = function(projectRoot) { | |
| var nodeRequire = require; | |
| var path = nodeRequire("path"); | |
| // normalize the project root path | |
| projectRoot = path.normalize(projectRoot); | |
| if(projectRoot[projectRoot.length -1] !== "/") { | |
| projectRoot += "/"; | |
| } |
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
| var util = require('./util'); | |
| module.exports = function(jsgiReq) { | |
| return Object.create(jsgiReq, { | |
| isXMLHttpRequest: getter(function() { | |
| return !util.no(this.headers['x-requested-with']); | |
| }), | |
| _paramGroups: { | |
| routeParams: { |
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
| <rewrite> | |
| <rules> | |
| <rule name="thing" stopProcessing="true"> | |
| <match url="(.*)" /> | |
| <conditions> | |
| <add input="{HTTP_HOST}" pattern="(.*?)\.(.*?)\..*" /> | |
| </conditions> | |
| <action type="Redirect" url="https://www.google.com?sub={C:1}&asdf={C:2}&path={R:0}" /> | |
| </rule> | |
| </rules> |
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
| var bogart = require('bogart'); | |
| var router = bogart.router(); | |
| router.get('/', function(req) { | |
| return bogart.file('index.html'); | |
| }); | |
| var app = bogart.app(); | |
| app.use(bogart.batteries); | |
| app.use(router); |
NewerOlder