##recursive add all
git add --all
##commit
git commit -m "this is the commit message"
##squash
git reset --soft HEAD~2 && git commit
where 2 is the number of commits to squash
##recursive add all
git add --all
##commit
git commit -m "this is the commit message"
##squash
git reset --soft HEAD~2 && git commit
where 2 is the number of commits to squash
GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)
~=
&&
function() { | |
// http://stackoverflow.com/a/2117523/571637 | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
/* jshint bitwise: false */ | |
var r = Math.random() * 16 | 0; | |
var v = c === 'x' ? r : (r & 0x3 | 0x8); | |
return v.toString(16); | |
}); | |
} |
function() { | |
// persist the table so it doesn't need to be created every time | |
var crcTable = null; | |
var makeCrcTable = function() { | |
var c; | |
var table = []; | |
for (var n = 0; n < 256; n++) { | |
c = n; |
{"Forecast":[{"CodedClouds":"BK","CodedCoverage":"C","CodedIntensity":"","CodedWeather":"T","ConditionIce":false,"ConditionRain":true,"ConditionSnow":false,"Day":1,"DayName":"Monday","Description":"Mostly Cloudy with Scattered Storms","DescriptionShort":"Scattered Storms","HighTempF":84,"Icon":"mcloudyt.png","LowTempF":73,"PossOfPrecip":80,"PrecipMM":24.26,"SnowMM":0,"Timestamp":"\/Date(1431950400000-0400)\/","WindDir":"SE","WindKPH":12},{"CodedClouds":"BK","CodedCoverage":"S","CodedIntensity":"","CodedWeather":"T","ConditionIce":false,"ConditionRain":true,"ConditionSnow":false,"Day":2,"DayName":"Tuesday","Description":"Mostly Cloudy with Isolated Storms","DescriptionShort":"Isolated Storms","HighTempF":86,"Icon":"mcloudyt.png","LowTempF":72,"PossOfPrecip":38,"PrecipMM":2.03,"SnowMM":0,"Timestamp":"\/Date(1432036800000-0400)\/","WindDir":"ESE","WindKPH":17},{"CodedClouds":"SC","CodedCoverage":"S","CodedIntensity":"","CodedWeather":"T","ConditionIce":false,"ConditionRain":true,"ConditionSnow":false,"Day":3,"Da |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
using System.Threading; | |
namespace Whatever | |
{ | |
public class HttpResponseData |
private HttpWebRequest CreateWebRequest(ApiCommands cmd, List<string> restParams, bool post = false) | |
{ | |
var url = new StringBuilder(); | |
url.AppendFormat("http://localhost:8080/api/v1/{0}", cmd); | |
if (restParams != null) | |
{ | |
restParams.ForEach(x => url.AppendFormat("/{0}", x)); | |
} | |
var request = (HttpWebRequest)WebRequest.Create(url.ToString()); | |
request.ContentType = "application/json"; |
private readonly List<Cookie> _cookies = new List<Cookie>(); | |
private readonly object _mutex = new object(); | |
private Dictionary<string, object> ReadResponse(HttpWebRequest request) | |
{ | |
string rawResponse; | |
var cookieJar = new CookieContainer(); | |
request.CookieContainer = cookieJar; |
[Fact] | |
public void test_byte_encoding_decoding() | |
{ | |
var encoding = new UTF8Encoding(); | |
byte[] inputBytes = encoding.GetBytes("sample"); | |
var hexString = BitConverter.ToString(inputBytes); | |
byte[] outputBytes = hexString.Split('-').Select(hex => byte.Parse(hex, NumberStyles.HexNumber)).ToArray(); | |
Assert.Equal(inputBytes, outputBytes); |
/// <summary> | |
/// System.Collections.Generic.KeyValuePair has not setters so we have to roll our own in order to serialize. | |
/// </summary> | |
[Serializable] | |
[XmlType(TypeName = "KVP")] | |
public struct SerializableKeyValuePair<K, V> | |
{ | |
public K Key { get; set; } | |
public V Value { get; set; } | |
} |