Skip to content

Instantly share code, notes, and snippets.

@pragmaticlogic
pragmaticlogic / node-apps-startup.sh
Last active September 4, 2020 14:58
node-apps-startup.sh
#!/bin/bash
#
# An init.d script for running a Node.js process as a service using iptables, forever and bouncy
# Reference:
# 1- https://github.com/nodejitsu/forever
# 2- https://www.exratione.com/2013/02/nodejs-and-forever-as-a-service-simple-upstart-and-init-scripts-for-ubuntu/
source /home/kle/.nvm/nvm.sh
NAME="Script for all NodeJS apps"
NVM_VERSION="v0.10.31"
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ButtonWithImage.MainPage"
Title="Button Image Sample"
BackgroundColor="White">
<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:Key="RefreshImage" x:TypeArguments="ImageSource">
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ButtonWithImage.MainPage"
Title="Button Image Sample"
BackgroundColor="White">
<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:Key="RefreshImage" x:TypeArguments="ImageSource">
<StackLayout VerticalOptions="End">
<StackLayout IsVisible="{Binding NoConnection}" x:Name="ButtonStackLayout" Orientation="Horizontal" Spacing="10" Padding="10,10,10,10" BackgroundColor="#E3E3E3">
<StackLayout HorizontalOptions="Start">
<Label x:Name="ButtonLabel" BackgroundColor="#E3E3E3" Text="Retry" TextColor="Black" VerticalOptions="Center" />
</StackLayout>
<StackLayout HorizontalOptions="CenterAndExpand"></StackLayout>
<StackLayout HorizontalOptions="End">
<Image x:Name="ButtonImage" BackgroundColor="#E3E3E3" WidthRequest="24" Source="{StaticResource RefreshImage}" VerticalOptions="Center" />
</StackLayout>
</StackLayout>
<StackLayout VerticalOptions="End">
<StackLayout IsVisible="{Binding NoConnection}" x:Name="ButtonStackLayout" Orientation="Horizontal" Spacing="10" Padding="10,10,10,10" BackgroundColor="#E3E3E3">
<StackLayout HorizontalOptions="StartAndExpand">
<Label x:Name="ButtonLabel" BackgroundColor="#E3E3E3" Text="Retry" TextColor="Black" VerticalOptions="Center" />
</StackLayout>
<StackLayout HorizontalOptions="EndAndExpand">
<Image x:Name="ButtonImage" BackgroundColor="#E3E3E3" WidthRequest="24" Source="{StaticResource RefreshImage}" VerticalOptions="Center" />
</StackLayout>
</StackLayout>
</StackLayout>
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ButtonWithImage.MainPage"
Title="Button Image Sample"
BackgroundColor="White">
<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:Key="RefreshImage" x:TypeArguments="ImageSource">
(function() {
'use strict';
angular.module('app').
factory('authService', ['$http', '$q', '$window',
function($http, $q, $window) {
const storage = $window.localStorage;
let cacheToken = {};
return {
getAuthorizationHeader() {
if (cacheToken.access_token && cacheToken.expires_on > moment(new Date().getTime()).unix()) {
<!doctype html>
<html ng-app="plunker">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<script src="angular-round-progress-directive.js"></script>
<script src="script.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
angular.module('plunker', ['ui.bootstrap', 'angular.directives-round-progress']);
var ModalDemoCtrl = function ($scope, $modal) {
$scope.launchModalTimer = function () {
var modalInstance = $modal.open({
templateUrl: 'modalContent.html',
controller: ModalInstanceCtrl
});
};
};
class Program
{
private static Func<int>[] GetFunc()
{
int SIZE = 5;
Func<int>[] func = new Func<int>[SIZE];
for (int i = 0; i < SIZE; i++)
{
int j = i;
func[i] = () => j;