-
Your API should be designed around the idea of resources.
-
Resources represent things (nouns) and not behaviors (verbs).
-
Each resource should have a canonical/unique url (
api/users/bill
,api/users/mary
). -
Return all resource properties in the return payload.
This file contains 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 MyRetryPolicy(maxRetries: Int) extends RetryPolicy { | |
override def onReadTimeout(statement: Statement, | |
cl: ConsistencyLevel, | |
requiredResponses: Int, | |
receivedResponses: Int, | |
dataRetrieved: Boolean, | |
nbRetry: Int): RetryDecision = { | |
if (nbRetry < maxRetries) RetryDecision.retry(cl) else RetryDecision.rethrow() | |
} |
This file contains 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 a list of trusted hosts | |
Get-Item WSMan:\localhost\Client\TrustedHosts | |
# Note that these commands don't create a list of trusted hosts, it simply replaces the trusted host with what you set via the command. If you need to add multiple hosts, they need to be comma seperated | |
# Trust all computers in a domain | |
Set-Item WSMan:\localhost\Client\TrustedHosts *.contoso.com | |
# Turst a single machine | |
Set-Item WSMan:\localhost\Client\TrustedHosts -Value myserver |
This file contains 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 -e | |
# Argument = -h -v -i groupId:artifactId:version -c classifier -p packaging | |
#shopt -o -s xtrace | |
# Define Nexus Configuration | |
NEXUS_BASE=http://repository.example.com:8081/nexus #this URL shouldn't end in a / | |
REST_PATH=/service/local | |
ART_REDIR=/artifact/maven/redirect |
This file contains 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
<project name="migrations"> | |
<target name="prefix-new-migrations"> | |
<foreach target="rename-file" param="the-file"> | |
<path> | |
<!-- The hardcoded directory containing the migrations --> | |
<fileset dir="./src/db/migrations" casesensitive="no" includes="*.sql"> | |
<!-- Exclude any migration files which have already been prefixed --> | |
<not> | |
<filename regex="\d+__.*" casesensitive="true"/> |
This file contains 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 com.datastax.driver.core.*; | |
public class GettingStartedTwo { | |
public static void main(String[] args) { | |
Cluster cluster; | |
Session session; | |
ResultSet results; | |
Row rows; |
This file contains 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
Function Get-AzurePublicIPRangesXMLFile | |
{ | |
<# | |
.SYNOPSIS | |
This function downloads the Azure IP ranges XML file to the current directory or a specified path. | |
.DESCRIPTION | |
This function downloads the Azure IP ranges XML file to the current directory or a specified path. | |
.PARAMETER AzureIPRangeURL | |
An optional parameter that is the URL to the Azure IP range XML file download page. | |
.PARAMETER DestinationPath |
This file contains 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
# | |
# LICENSE: https://gist.github.com/aj-jester/e0078c38db9eb7c1ef45 | |
# | |
require 'json' | |
module JSON | |
class << self | |
@@loop = 0 | |
def sorted_generate(obj) |
This file contains 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
#!/usr/bin/ruby | |
=begin | |
## USAGE: | |
# Ruby: | |
ruby gem-fetch-dependencies.rb fetch <gem_name> --dependencies | |
# JRuby: | |
jruby gem-fetch-dependencies.rb fetch <gem_name> --dependencies |
This file contains 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
validate email: /\A([\w\.\-\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i | |
validate url: ^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ix | |
validate ip: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i | |
validate ip ranges: /^\b(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-4]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9]?)\b$/i | |
validate netmask: /^(((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(0|128|192|224|240|248|252|254)\.0\.0)|(255\.255\.(0|128|192|224|240|248|252|254)\.0)|(255\.255\.255\.(0|128|192|224|240|248|252|254)))$/i |
OlderNewer