Skip to content

Instantly share code, notes, and snippets.

View nuno's full-sized avatar

Nuno Costa nuno

View GitHub Profile
@nuno
nuno / server.ts
Created May 13, 2019 12:02 — forked from ssatz/server.ts
AngularV5 + MaterializeCss(without Jquery) support for Server Side Rendering
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import { enableProdMode } from '@angular/core';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { join } from 'path';
import { readFileSync } from 'fs';
const domino = require('domino');
// Faster server renders w/ Prod mode (dev mode never needed)
enableProdMode();
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule KeyboardAvoidingScrollView
* @flow
* @format
*/
'use strict';
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Ionic App</title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
@nuno
nuno / gridItem.js
Created December 13, 2016 11:49 — forked from swennemans/gridItem.js
simple infinite scroll gridView example
var React = require('react-native');
var {
Text,
View,
StyleSheet
} = React;
var styles = StyleSheet.create({
photo: {
@nuno
nuno / cache.js
Created September 18, 2016 13:33 — forked from decklord/cache.js
This file is a cache module for Appcelerator Platform, now it works just with images but can be extended to support other stuff. Currently supports n number of retries and gets the image path on a callback, so you don't need to fake a dummy imageView if you want to precache some image.
exports.image = function(url, callback, directory) {
if (directory === undefined) {
var directory = 'cachedImages';
}
var filename = Ti.Utils.md5HexDigest(url);
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, directory, filename);
@nuno
nuno / conversation.js
Created September 8, 2016 14:09
Titanium - Smoothly animating an input field along with the iOS Keyboard.
function init() {
Titanium.App.addEventListener('keyboardframechanged', $.typingArea.animateKeyboard);
}
function scrollToBottom() {
$.listView.scrollToItem(0, $.section.items.length - 1, {
animated : true
});
}
@nuno
nuno / rating.js
Created September 8, 2016 14:06 — forked from chmiiller/rating.js
A draggable and swipeable 5 stars rating view for Android and iOS
var win = Ti.UI.createWindow({
backgroundColor:'#eeeeee'
});
var isAndroid = Ti.Platform.osname == "android";
var starSelectedImage = '/images/ic_star_black.png';
var starOriginalImage = '/images/ic_star_border_black.png';
//icons from Google Material Design (search for the "star" icon): https://design.google.com/icons/
var starWidth = 28;
var coverView = Ti.UI.createView();
@nuno
nuno / generateSplash.js
Created August 27, 2016 13:01 — forked from dawsontoth/generateSplash.js
Start with a 1000x1000 PSD with an icon in the middle. In Photoshop select File > Scripts > Browse... generateSplash.js. Saves out to ../Resources/iphone and android.
/*
Define our various sizes.
*/
var AndroidSizes = {
'android/images/res-ldpi/splash.9.png': 240,
'android/images/res-mdpi/splash.9.png': 360,
'android/images/res-hdpi/splash.9.png': 480,
'android/images/res-xhdpi/splash.9.png': 720,
'android/images/res-xxhdpi/splash.9.png': 960,
'android/images/res-xxxhdpi/splash.9.png': 1440
@nuno
nuno / Using Xcode 7.3.1 and iOS 10 devices
Last active June 20, 2016 15:11 — forked from steipete/ios-xcode-device-support.sh
Using Xcode 7.3.1 and iOS 10 devices
// The trick is to copy the DeviceSupport folder from the beta to the stable version.
cp -r /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.0\ \(14A5261u\) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
// Then restart Xcode. You might need to do that for every beta of iOS 10/Xcode 8.
@nuno
nuno / sticky-table-headerview.js
Created June 16, 2016 13:27 — forked from tzmartin/sticky-table-headerview.js
Titanium Sticky Header
// just a quick n dirty test. See result: http://monosnap.com/file/wT6dJZ4zOrHzjiXi1mhfnIocEZiAWW
var headerView = Ti.UI.createView({
backgroundColor:'#fff',
height:80,
layout:'horizontal'
});
headerView.add(Ti.UI.createButton({title:'$100',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));
headerView.add(Ti.UI.createButton({title:'$500',left:20,top:13,height:50,width:80,backgroundColor:'#ca3943',borderRadius:4,color:'#fff'}));