Skip to content

Instantly share code, notes, and snippets.

View ChrisFlannagan's full-sized avatar

Chris Flannagan ChrisFlannagan

View GitHub Profile
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
<StackLayout>
<Label text="Tap the button" class="title"/>
<Button text="TAP" tap="{{ onTap }}" />
<Label text="{{ message }}" class="message" textWrap="true"/>
</StackLayout>
</Page>
/**
* Created by Chris on 7/29/16.
*
* Modified code from bfattori & N3ll on github
*
* function allows gradients to be applied to the background of view elements on Android & iOS
*
*/
var platform = require("platform");
var page;
exports.loaded = function(args) {
page = args.object;
fetch("https://www.babyquasar.com/wp-json/posts", {
method: "GET",
body: '',
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}
var ObservableArray = require("data/observable-array").ObservableArray;
var Observable = require("data/observable").Observable;
var page;
exports.loaded = function(args) {
var postTitles = new ObservableArray([].map(function(postTitle) {
return new Observable({
postName: postTitle
});
}));
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="loaded">
<StackLayout>
<Label text="Our Posts" class="title"/>
<ListView height="100%" items="{{ postList }}">
<ListView.itemTemplate>
<Label class="post-title" text="{{ postName }}" textWrap="true" horizontalAlignment="left" />
</ListView.itemTemplate>
</ListView>
</StackLayout>
</Page>
posts.forEach(function(post) {
console.log(post['title']);
});
fetch("https://www.babyquasar.com/wp-json/posts", {
method: "POST",
body: "filter[category]=Tutorials&filter[posts_per_page]=5",
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
}
})
<AbsoluteLayout row="3" id="main-layout" width="100%"
backgroundImage="~/images/face.jpg">
<Image id="s1" visibility="{{ c1 ? 'visible' : 'collapsed' }}" width="{{ parentWidth }}"
left="0" top="0" class="face-sector" src="~/images/face-sectors/top-right.png">
</Image>
<Image id="s2" visibility="{{ c2 ? 'visible' : 'collapsed' }}" width="{{ parentWidth }}"
left="0" top="0" class="face-sector" src="~/images/face-sectors/top-left.png">
</Image>
<Image id="s3" visibility="{{ c3 ? 'visible' : 'collapsed' }}" width="{{ parentWidth }}"
left="0" top="0" class="face-sector" src="~/images/face-sectors/bottom-right.png">
var viewModule = require("ui/core/view");
var gestures = require("ui/gestures");
var observable = require("data/observable");
var pageData = new observable.Observable();
var page;
var quad;
exports.loaded = function(args) {
page = args.object;