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
public string GetUsername() | |
{ | |
var url = new Uri(API_URL_BASE); | |
var client = new HttpClient() { BaseAddress = url }; | |
var response = client.GetAsync(url).Result; | |
response.EnsureSuccessStatusCode(); | |
return response.Content.ReadAsStringAsync().Result; | |
} |
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
// Create an OpenFilePicker starting in the pictures library, viewing thumbnails | |
var filePicker = new FileOpenPicker(); | |
filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; | |
filePicker.ViewMode = PickerViewMode.Thumbnail; | |
// Filter to include a sample subset of file types | |
filePicker.FileTypeFilter.Clear(); | |
filePicker.FileTypeFilter.Add(".bmp"); | |
filePicker.FileTypeFilter.Add(".png"); | |
filePicker.FileTypeFilter.Add(".jpeg"); |
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
public void AddPhoto() | |
{ | |
DispatcherHelper.CheckBeginInvokeOnUI(() => { PickPhoto(); }); | |
} |
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
var uri = new Uri(API_URL_MEDIA); | |
var content = new MultipartFormDataContent(); | |
content.Add(new StringContent(caption), ""caption""); | |
var t = new StreamContent(photoContents); | |
t.Headers.ContentType | |
= new System.Net.Http.Headers.MediaTypeHeaderValue(contentType); | |
fileName = string.IsNullOrEmpty(fileName) ? ""img.png"" : fileName; | |
content.Add(t, ""media"", """ + fileName + """); | |
var response = PostBuffer(uri, content); | |
response.EnsureSuccessStatusCode(); |
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
var baseAddress = new Uri(API_URL_BASE); | |
var cookieContainer = new CookieContainer(); | |
using (var handler = new HttpClientHandler() { CookieContainer = cookieContainer }) | |
using (var client = new HttpClient(handler) { BaseAddress = baseAddress }) | |
{ | |
// some defaults, add a header and cookie for authenticating with the API | |
client.DefaultRequestHeaders.Add("User-Agent", USER_AGENT); | |
client.DefaultRequestHeaders.Add("X-AvoSig", AvoSignature); | |
cookieContainer.Add(baseAddress, new Cookie(COOKIE_NAME, CookieValue)); | |
// Post the content and return the result |
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
for(i=1;i<101;i++){r=i%3?'':'fizz';r+=i%5?'':'buzz';!r||console.log(r)} |
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 injectViewportMetaTag() { | |
var meta = $(document.createElement('meta')); | |
meta.name = 'viewport'; | |
meta.content = 'width=device-width, initial-scale=1'; | |
$$('head')[0].insert(meta); | |
}; |
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 injectSignature() { | |
var footer = $(document.getElementById('footer')); | |
footer.appendChild(document.createTextNode | |
("Responsive Theme by Xander Dumaine 2011")); | |
} |
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 injectAppleTouchIcons() { | |
var link = $(document.createElement('link')); | |
link.setAttribute('rel', 'apple-touch-icon'); | |
link.setAttribute('href', '/themes/mobile/images/touch/apple-touch-icon.png'); | |
$$('head')[0].insert(link); | |
link = $(document.createElement('link')); | |
link.setAttribute('rel', 'apple-touch-icon'); | |
link.setAttribute('href', '/themes/mobile/images/touch/apple-touch-icon-72x72-precomposed.png'); | |
link.setAttribute('sizes', '72x72'); |
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
@media only screen and (min-device-width: 480px) { ... } | |
@media only screen and (min-device-width: 600px) { ... } | |
@media only screen and (min-width: 770px) { ... } |