Skip to content

Instantly share code, notes, and snippets.

View anuith's full-sized avatar
💭
Hello World

Thiwakorn anuith

💭
Hello World
View GitHub Profile
@anuith
anuith / majormovies.json
Created July 12, 2023 05:23
Major Movies
{"movies":[{"id":1494,"movieCode":["HO00004079"],"title_en":"The Lord of the Rings The Return of the King","title_th":"มหาสงครามชิงพิภพ","rating":"ทป.","rating_id":1,"duration":201,"release_date":"2023-07-13","sneak_date":"2021-04-22","synopsis_th":"การเดินทางของเหล่าพันธมิตรผู้กล้าแห่งวงแหวนกำลังจะถึงคราวสิ้นสุด! The Lord of the Rings: The Return of the King พร้อมส่งบทสรุปแห่งมหาสงครามชิงพิภพ ณ ดินแดนมิดเดิลเอิร์ธ ฝีมือการกำกับภาพยนตร์ของ ปีเตอร์ แจ็คสัน (Peter Jackson) จากบทภาพยนตร์ของทีมนักเขียนบทภาพยนตร์ ฟราส วอล์ช (Fran Walsh), ฟิลลิปปา โบเยนส์ (Philippa Boyens) และตัวแจ็คสันเอง ภาพยนตร์ดัดแปลงจากปลายปากกาการเขียนของ เจ.อาร์.อาร์. โทลคีน (J.R.R. Tolkien) พร้อมกลับมาฉายบนจอยักษ์อีกครั้ง เฉพาะโรงภาพยนตร์ที่เปิดบริการ\r\n","synopsis_en":"Gandalf and Aragorn lead the World of Men against Sauron's army to draw his gaze from Frodo and Sam as they approach Mount Doom with the One Ring.\r\n","director":"Peter Jackson","actor":"Orlando Bloom/Sean Bean/Karl Urban/Elijah Wood/Ian McKellen/Cate Blanchett/Andy Serk
@anuith
anuith / MoviesSampleDataSource.cs
Last active December 19, 2015 00:39
Sample data source class to use in design-time
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.ApplicationModel.Resources.Core;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml.Data;
@anuith
anuith / MoviesDataSource-additional.cs
Created June 26, 2013 18:13
additional functions to asynchronously load data MSP Boot Camp 2013
public static async Task LoadLocalDataAsync()
{
// Retrieve recipe data from Recipes.txt
var file = await Package.Current.InstalledLocation.GetFileAsync("Assets\\movies.json");
var result = await FileIO.ReadTextAsync(file);
// Parse the JSON recipe data
var movies = JsonArray.Parse(result);
// Convert the JSON objects into RecipeDataItems and RecipeDataGroups
@anuith
anuith / MoviesDataSource.cs
Created June 26, 2013 18:11
MoviesDataSource.cs - MSP Boot Camp 2013
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.ApplicationModel.Resources.Core;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml.Data;
var selectionRect = event.srcElement.getBoundingClientRect();
var buttonCoordinates = { x: selectionRect.left, y: selectionRect.top, width: selectionRect.width, height: selectionRect.height };
var placement = Windows.UI.Popups.Placement.above;
var id = (data.place.countryCode + "-" + data.place.city).replace(" ", "_");
var displayName = data.place.city + " weather ";
var shortName = data.place.city;
var argument = id + "-pin";
var options = Windows.UI.StartScreen.TileOptions.showNameOnLogo;
var imageUri = new Windows.Foundation.Uri("ms-appx:///images/logo150.png");
@anuith
anuith / unpinSecondaryTiles.js
Created December 20, 2012 19:14
The function to unpin secondary tile
function unpinByElementAsync(element, unwantedTileID) {
var selectionRect = element.getBoundingClientRect();
var buttonCoordinates = { x: selectionRect.left, y: selectionRect.top, width: selectionRect.width, height: selectionRect.height };
var placement = Windows.UI.Popups.Placement.above;
var tileToDelete = new Windows.UI.StartScreen.SecondaryTile(unwantedTileID);
return new WinJS.Promise(function (complete, error, progress) {
tileToGetDeleted.requestDeleteForSelectionAsync(buttonCoordinates, placement).done(function (isDeleted) {
var reference = Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(dataToShare.photoFile);
dataRequest.properties.thumbnail = reference;
dataRequest.setBitmap(reference);
@anuith
anuith / calling_Data.getWeatherFromLocation.js
Created December 20, 2012 05:36
Calling the getWeatherFromLocation commands
Data.getWeatherFromLocation(13.739135, 100.547324).then(function (result) {
WinJS.Binding.processAll(element.querySelector("#weatherData"), result);
});
@anuith
anuith / getWeatherFromLocation.js
Created December 20, 2012 05:34
the getWeatherFromLocation function
function getWeatherFromLocation(lat, lon) {
return new WinJS.Promise(function (complete, error, process) {
WinJS.xhr({ url: "http://api.wunderground.com/api/" + apiKey + "/conditions/q/" + lat + "," + lon + ".json" })
.then(function (xhr) {
var result = JSON.parse(xhr.responseText).current_observation;
var condition = {
icon: result.icon_url,
temp: result.temp_c,