text:
<?php

// Protect from unauthorized access
defined('F0F_INCLUDED') or die;

/**
 * FrameworkOnFramework model behavior dispatcher class
 *
 * @package  FrameworkOnFramework
 * @since    2.1
 */
class F0FModelDispatcherBehavior extends F0FUtilsObservableDispatcher
{
}

redpajama_set_name: RedPajamaGithub


text:
module Async
  module WebSocket
    class Client < ::Protocol::HTTP::Middleware
      include ::Protocol::WebSocket::Headers

      def self.connect(endpoint, *args, **options, &block)
        self.open(endpoint, *args) do |client|
          connection = client.connect(endpoint.authority, endpoint.path, **options)

          return connection unless block_given?

          begin
            yield connection
          ensure
            connection.close
          end
        rescue
          puts "cant connect to #{endpoint}"
        end
      end
    end

    class Connection < ::Protocol::WebSocket::Connection

      def write(object)
        super(object)
      end

      def parse(buffer)
        buffer
      end
    end
  end
end


text:
from django.contrib.contenttypes import generic
from django.contrib.gis import admin
from procyon.starsystemmaker.models import *
import locale
from django.http import HttpResponseRedirect

class PlanetFeatureAdmin(admin.ModelAdmin):
    model = PlanetFeature
    list_display = ['short_name']

class PlanetModelAdmin(admin.ModelAdmin):
    model = PlanetModel
    exclude = ['parent_star', ]
    list_display = ['name', 'planet_type', 'mass', 'radius', 'surface_ocean_amount', 'other_name', 'parent_star', ]

def make_initialized(modeladmin, request, queryset):
    for obj in queryset:
        obj.build_model(forced=True)
make_initialized.short_description = "Initialize all variables of selected stars"

def make_randomized(modeladmin, request, queryset):
    for obj in queryset:
        obj.build_model(forced=False)
make_randomized.short_description = "Randomize variables of selected stars based on random seed"

def blank_all_starmodels(modeladmin, request, queryset):
    StarModel.objects.all().update(json_of_closest_stars='', guessed_age=0, guessed_temp=0, guessed_mass=0,
                                   guessed_radius=0, rand_seed=0)
blank_all_starmodels.short_description = "(select one, but) Delete ALL simulated data from ALL star models"

def view_star_as_json(modeladmin, request, queryset):
    star = queryset[0].star
    if star and star.id:
        star_id = star.id
        return HttpResponseRedirect("/maker/star/{0}".format(star_id))
view_star_as_json.short_description = "View star JSON info"

class StarModelAdmin(admin.ModelAdmin):
    #TODO: Editing doesn't work when saving from admin menu
    model = StarModel
    list_display = ['id', 'real_star_id', 'star', 'star_schema', 'star_type', 'luminosity_class', 'base_color', 'mass_in_sol', 'radius_in_sol', 'age_in_my']
    exclude = ['star', 'location']
    search_fields = ['id', ]
    list_filter = ['star_type', 'luminosity_class']
    actions = [make_initialized, make_randomized, view_star_as_json, blank_all_starmodels]

    def star_schema(self, obj):
        spectrum = obj.star
        if spectrum and spectrum.spectrum:
            output = spectrum.spectrum
        else:
            output = "Unknown"
        return output

    def star_type_name(self, obj):
        star_type = obj.star_type
        if star_type:
            output = obj.star_type.name.capitalize()
        else:
            output = "Unknown"
        return output

    def mass_in_sol(self, obj):
        output = obj.guessed_mass
        if output:
            output = "{0:.2f}".format(output)
        else:
            output = "Not Yet Initialized"
        return output

    def radius_in_sol(self, obj):
        output = obj.guessed_radius
        if output:
            output = "{0:.2f}".format(output)
        else:
            output = "Not Yet Initialized"
        return output

    def age_in_my(self, obj):
        output = obj.guessed_mass
        if output:
            output = locale.format("%d", obj.guessed_age, grouping=True)
        else:
            output = "Not Yet Initialized"
        return output

    def real_star_id(self, obj):
        star = obj.star
        if star:
            return star.id
        else:
            return "Unknown"

class PlanetTypeAdmin(admin.ModelAdmin):
    model = PlanetType
    list_display = ['name', 'mass_range', 'radius_range', 'temperature_range', ]

admin.site.register(StarModel, StarModelAdmin)
admin.site.register(PlanetModel, PlanetModelAdmin)
admin.site.register(PlanetType, PlanetTypeAdmin)
admin.site.register(PlanetFeature, PlanetFeatureAdmin)


text:
using System.Threading;
using System.Threading.Tasks;
using Recaster.Multicast;

namespace Recaster.Endpoint
{
    public interface IReceiver
    {
        Task StartAsync(CancellationToken ct);
        void Stop();
        Task<MulticastMessage> GetMessageAsync(CancellationToken ct);
    }
}


text:
function createRenderTarget() {
  let element = document.createElement('div');
  element.className = 'cycle-test';
  document.body.appendChild(element);
  return element;
}

export default createRenderTarget


text:
<!--
  $Id: package.html 35197 2011-07-22 14:56:25Z juergens $
  @version $Rev: 35197 $
  @ConQAT.Rating GREEN Hash: 6E66C034E677CC85542D85245C24F93F
-->
<body>
This package contains a generalized storage system. The idea is to have
a very simple interface onto which both more complex stores (e.g. for
index-based clone detection) and different back-end storage systems can
be mapped. The implementation is kept simple, to allow both the usage
with databases but also simple distributed key-value stores (Bigtable,
HBase, Cassandra). This also is the reason for the use of byte arrays in
the main interface, as this is the common denominator between all those
systems. The actual client code should use one of the utility classes
that can deal with more complex types.
</body>


text:
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Alliance E-Learning System</title>

    <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <link href="../dist/css/sb-admin-2.css" rel="stylesheet">

    <link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    Toggle navigation

                </button>
                AES

                         username123

 User Profile

 Logout

                                 My Courses

                                        J2EE Intermediate

                                                Course Outline

                                                Exams

                                        Past Courses

                                 My Exams

                                        Upcoming Exams

                                        Past Exams

                                 My Profile

                                        View Profile

                                        Edit Profile

                                        Change Password

Profile

                      <button type="button" class="btn btn-default btn-block">Upload Picture</button>
                      <button type="button" class="btn btn-default btn-block">Edit Profile</button>
                      <button type="button" class="btn btn-default btn-block">Change Password</button>

                        <form class="form-horizontal" role="form">

                            First Name

                              <input class="form-control" id="inputEmail3"  value="Mark">

                            Last Name

                              <input class="form-control" id="inputPassword3" value="Saren">

                            Username

                              <input class="form-control" id="inputPassword3"  value="username123">

                            Company ID

                              <input class="form-control" id="inputPassword3"  value="123456">

                            Position

                              <input class="form-control" id="inputPassword3"  value="Support Player">

                            Business Unit

                              <input class="form-control" id="inputPassword3"  value="Radiant">

                            Email

                              <input class="form-control" id="inputPassword3"  value="marksaren@gmail">

                              <button type="submit" class="btn btn-primary">Submit</button>
                              <button type="reset" class="btn btn-default">Reset</button>
                              <button class="btn btn-danger">Cancel</button>

                        </form>


text:
import { TextDocument, Location } from 'vscode-languageserver';
import { ISettings } from '../types/settings';
import { ICache } from '../services/cache';
/**
 * Do Go Definition :)
 */
export declare function goDefinition(document: TextDocument, offset: number, cache: ICache, settings: ISettings): Promise<Location>;


text:
/* Site Wide to go with new header */
body#home {
}
.Content.Widest.Two#LayoutColumn1 {
	top: inherit;
}
.Left.fleft {
	padding-right: 54px;
}
.green {
	color: #39b54a;
}
.lightgreen {
	color: #6ADA78;
}
/* caret arrow down up */
.fa-caret-up:before {
	content: "\f0d8";
}
.fa-caret-down:before {
	content: "\f0d7";
}
/* mobile */
.fa-mobile-phone:before, .fa-mobile:before {
  content: "\f10b";
}
/* envelope */
.fa-envelope:before {
	content: "\f0e0";
}
/* home */
.fa-home:before {
	content: "\f015";
}

/* Category list improvements */
#biosnippet {
	display: none;
}
.page .main {
	margin-top: 20px;
}
.page .main .inner .Left.fleft {
	border: 2px solid #eaeaea;
	padding: 0 15px;
	margin: 0 30px 0 0;
	width: 200px;
}
.page .main .inner .Left #SideCategoryList .treeview li {
	margin: 0;
	border: 0;
}
.page .main .inner .Left #SideCategoryList .treeview li a {
	border-bottom: 0;
}

/* New Header */
.header {
}

/* Top Header - top section of three section header */
.header .TopMenu {
    background-color: #fff;
    border-top: 0;
    border-bottom: 3px solid #eeeeee;
    color: #666;
}
.header .TopMenu .inner {
    padding: 0;
    line-height: 30px;
}
.header .TopMenu .inner #loginContainer {
    float: left;
}
.header .TopMenu .inner #loginContainer #loginGreeting #loginGreetingName {
    font-weight: 600;
}
.header .TopMenu .inner #loginContainer #loginGreeting a {
    color: #39B54A;
}
.header .TopMenu .inner #loginContainer #loginGreeting a:hover {
    color: #666;
}
.header .TopMenu .inner #newTopMenu {
    color: #777;
    position: relative;
    overflow: visible;
}
.header .TopMenu .inner #newTopMenu > li {
    line-height: 30px;
}
.header .TopMenu .inner #newTopMenu li a {
    color:#777;
}
.header .TopMenu .inner #newTopMenu li a:hover {
    color:#39b54a
}
#wikiMenuTrigger {
	position: relative;
	padding: 0;
}
#wikiMenuTrigger > a {
	-webkit-transition: none;
	-moz-transition: none;
	-o-transition: none;
	transition: none;
    line-height: 24px !important;
    padding: 2px 9px !important;
    border-color: transparent;
    border-style: solid;
    border-width: 1px 1px 0 1px;
    background-color: #fff;
}
#wikiMenuTrigger.open > a {
    border-color: #999;
    box-shadow: 2px -4px 4px 3px rgba(0,0,0,0.1);
    color: #39B54A;
    z-index: 999 !important;
    position: relative;
}
#wikiMenuDropDown {
    border: solid 1px #999;
    background-color: #fff;
    box-shadow: 2px 2px 5px 2px rgba(0,0,0,0.1);
    position: absolute;
    top: 28px;
    z-index: 101;
    padding: 13px 27px;
    left: -410px;
    width: 730px;
    display: none;
}
#wikiMenuDropDown ul.wiki-item-menu {
    position: static;
    float: none;
    overflow: visible;
    white-space: normal;
}
#wikiMenuDropDown ul.wiki-item-menu li.wiki-item {
    display: block;
    text-align: left;
    padding: 2% 1%;
    font-size: 15px;
    border-radius: 3px;
    display: inline-block;
    width: 31%;
}
#wikiMenuDropDown ul.wiki-item-menu li.wiki-item:hover {
    border-left-color: #39B54A;
    background: #F3F4F4;
}
#wikiMenuDropDown ul.wiki-item-menu li.wiki-item a .wiki-inner > div {
    vertical-align: middle;
}
#wikiMenuDropDown ul.wiki-item-menu li.wiki-item a .wiki-inner .wiki-left img {
    width: 37px;
    height: 37px;
}
#wikiMenuDropDown ul.wiki-item-menu li.wiki-item a .wiki-inner .wiki-right {
	    white-space: normal;
    width: 170px;
    font-size: 13px;
    line-height: 17px;
}
.header .TopMenu .inner #newTopMenu #helpMenuTrigger {
    line-height: 30px;
    box-sizing: border-box;
    position: relative;
    z-index: 106;
    cursor: default;
}
.header .TopMenu .inner #newTopMenu #helpMenuTrigger.open {
    padding: 0 !important;
}
.header .TopMenu .inner #newTopMenu #helpMenuTrigger.open .helpMenuText {
    line-height: 24px !important;
    padding: 2px 9px !important;
    border-color: #999;
    border-style: solid;
    border-width: 1px 1px 0 1px;
    background-color: #fff;
    box-shadow: 2px -4px 4px 3px rgba(0,0,0,0.1);
    color: #39B54A;
    z-index: 999 !important;
    position: relative;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown {
    border: solid 1px #999;
    background-color: #fff;
    box-shadow: 2px 2px 5px 2px rgba(0,0,0,0.1);
    position: absolute;
    top: 28px;
    z-index:101;
    padding: 4px 4px 13px;
    right: -2px;
    display: none;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown ul {
    position: static;
    float: none;
    overflow: visible;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li {
    display: block;
    text-align: center;
    padding: 7px 10px;
    font-size: 15px;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li .customerService {
    text-transform: uppercase;
    cursor: default;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li .fa-mobile {
    font-size: 28px;
    line-height: 20px;
    vertical-align: middle;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li .phoneNumber {
    vertical-align: middle;
    font-size: 15px;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li .phoneTime {
    display: block;
    font-size: 10px;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li .helpMenuEmailLink {
    font-size: 15px;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li .btn {
    height:auto;
    padding: 6px;
    color:#fff;
}
.header .TopMenu .inner #newTopMenu #helpMenuDropDown li .btn:hover {
    color:#39b54a;
}

/* Main Header - middle section of three section header */
.header #Header {
    margin: 10px 0;
}
.header #Header .header-logo {
    height: auto;
}
.header #Header .header-logo a img {
    width: 50px;
    height: 50px;
}
.header #Header .header-logo-text {
    display: table-cell;
    vertical-align: middle;
    padding: 0 0 0 4px;
}
.header #Header #LayoutColumn1 {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -moz-box-orient: horizontal;
    -webkit-box-direction: normal;
    -moz-box-direction: normal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
}
.header #Header .headerSearchContainer {
    overflow: auto;
    width: 65%;
    margin-right: 1%;
}
.header #Header .headerSearchContainer #SearchForm {
    float: left;
    display: block;
    width: 100%;
    margin: 3px auto;
    border: 2px solid #39B54A;
    border-radius: 3px;
    min-height: 40px;
    box-sizing: border-box;
}
.header #Header .headerSearchContainer #SearchForm form {
}
.header #Header .headerSearchContainer #SearchForm input.Textbox#search_query {
    float: none;
    height: auto;
    line-height: 3;
    line-height: 38px;
    font-size: 17px;
    width: 80%;
}
.header #Header .headerSearchContainer #SearchForm .Button {
    float: right;
    height: 40px;
    color: #fff;
    background-color: #39B54A;
    width: 40px;
}
.header #Header .headerSearchContainer #SearchForm .Button:hover {
    background-color: #666;
}
.header #Header .search-mobile #SearchForm input.Textbox#search_query {
    float: right;
}
.header #Header .search-mobile #SearchForm .Button {
    float: left;
}
body table#QuickSearch.QuickSearch {
    left: 37% !important;
}
.header #Header .inner #myAccountMenuTrigger {
    display: block;
    font-size: 13px;
    min-width: 122px;
    margin: 0 auto;
    position: relative;
    border: 1px solid transparent;
    border-width: 1px 1px 0 1px;
}
.header #Header .inner #myAccountMenuTrigger .myAccountHi {
    font-size: 12px;
}
.header #Header .inner #myAccountMenuTrigger .myAccountMyDS {
    font-weight: 600;
}
.header #Header .inner #myAccountMenuTrigger .myAccountMyDS .fa-caret.down {
    color: #111 !important;
}
.header #Header .inner #myAccountMenuTrigger #myAccountMenuLink {
    display: block;
    padding: 10px 10px 10px 14px;
    z-index: 100;
    position: relative;
    background-color: #fff;
}
.header #Header .inner #myAccountMenuTrigger.open {
    border-color: #999;
    border-style: solid;
    border-width: 1px 1px 0 1px;
    box-shadow: 4px -1px 4px -1px rgba(0,0,0,0.1);
    color: #39B54A;
    z-index: 999 !important;
}
.header #Header .inner #myAccountMenuDropDown {
    border: solid 1px #999;
    background-color: #fff;
    box-shadow: 1px 2px 5px 2px rgba(0,0,0,0.1);
    position: absolute;
    top: 50px;
    z-index: 99;
    right: -1px;
    font-size: 15px;
    display: none;
}
.header #Header .inner #myAccountMenuDropDown ul {
    margin:0;
    padding: 10px 0;
}
.header #Header .inner #myAccountMenuDropDown ul li {
    display: block;
    text-align: left;
    line-height: 27px;
    width: 200px;
}
.header #Header .inner #myAccountMenuDropDown ul li a {
    width: 90%;
    display: block;
    padding: 0 10px 0 10px;
    margin: 6px 0 6px 15px;
    box-sizing: border-box;
    border-left: 4px solid #eee;
}
.header #Header .inner #myAccountMenuDropDown ul li a:hover {
    border-left-color: #39B54A;
    background: #F3F4F4;
}
.header #Header .inner .header-secondary {
    top: 0;
    position: relative;
    margin-left: 1%;
}

/* SubHeader Header - bottom section of three section header */
.header #subHeader {
    background-color: #666;
}
.header #subHeader .inner {
    margin: 0 auto;
    width: 91%;
    max-width: 1280px;
}
.header #subHeader .inner {
    color: #fff;
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -moz-box-orient: horizontal;
    -webkit-box-direction: normal;
    -moz-box-direction: normal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
}
.header #subHeader .inner .shopByContainer {
    vertical-align: middle;
    height: 40px;
    padding: 0 121px 0 68px;
}
.header #subHeader .inner .shopByContainer i {
    padding: 5px;
}
.header #subHeader .inner .PageMenu {
    display: block;
    -webkit-box-flex: 7;
    -moz-box-flex: 7;
    width: 70%;
    -webkit-flex: 7;
    -ms-flex: 7;
    flex: 7;
}
.header #subHeader .inner .PageMenu ul {
    margin:0;
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: horizontal;
    -moz-box-orient: horizontal;
    -webkit-box-direction: normal;
    -moz-box-direction: normal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
}
.header #subHeader .inner .PageMenu ul li {
    -webkit-box-flex: 1;
       -moz-box-flex: 1;
        -webkit-flex: 1;
            -ms-flex: 1;
    flex: 1;
}
.header #subHeader .inner .PageMenu ul li#headerPipesUnder100Link,
.header #subHeader .inner .PageMenu ul li#headerFeeStuffLink {
    display: none;
}
.header #subHeader .inner .PageMenu ul li a {
    text-transform: none;
    line-height: 40px;
    color: #eaeaea;
    display: block;
    padding: 0 !important;
    text-align: center;
}
.header #subHeader .inner .PageMenu ul li:hover {
    background-color: #333;
}
.header #subHeader .inner .PageMenu ul li:hover a {
    color: #fff;
}
#headerShippingReturnsLink {
    display: none;
}
.header #subHeader .inner .freeShippingContainer {
    vertical-align: middle;
    height: 40px;
    -webkit-box-flex: 3;
    -moz-box-flex: 3;
    width: 30%;
    -webkit-flex: 3;
    -ms-flex: 3;
    flex: 3;
}
.header #subHeader .inner .freeShippingContainer a {
    display: block;
    height: 40px;
}
.header #subHeader .inner .freeShippingContainer .freeShippingText {
    float: right;
    font-style: italic;
    height: 40px;
    line-height: 40px;
    vertical-align: middle;
    display: inline-block;
    font-family: "Futura";
    color: #fff;
    -webkit-transition: all 0.27s ease;
    -moz-transition: all 0.27s ease;
    -o-transition: all 0.27s ease;
    transition: all 0.27s ease;
    font-size: 11px;
}
.header #subHeader .inner .freeShippingContainer .freeShippingTruck {
    background-image: url('//cdn6.bigcommerce.com/s-ss4br/templates/__custom/images/dankstop-sprite.png?t=1441330339');
    background-position: -8px -1px;
    background-repeat: no-repeat;
    background-size: 250%;
    width: 37px;
    height: 21px;
    margin: 8px 0;
    line-height: 40px;
    display: inline-block;
    float: right;
    -moz-transform: scaleX(-1) skewX(33deg);
    -o-transform: scaleX(-1) skewX(33deg);
    -webkit-transform: scaleX(-1) skewX(33deg);
    transform: scaleX(-1) skewX(33deg);
    filter: FlipH;
    -ms-filter: "FlipH";
    -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=-0.6494075931975105, M21=0, M22=1, SizingMethod='auto expand')";
    filter: progid:DXImageTransform.Microsoft.Matrix(
            M11=-1,
            M12=-0.6494075931975105,
            M21=0,
            M22=1,
            SizingMethod='auto expand');
    vertical-align: middle;
}
.header #subHeader .inner .freeShippingContainer .shippingLines {
    content: "";
    height: 40px;
    width: 30px;
    line-height: 40px;
    display: inline-block;
    vertical-align: middle;
    float: right;
    margin: 0px 4px;
    -webkit-transition: all 0.27s ease;
    -moz-transition: all 0.27s ease;
    -o-transition: all 0.27s ease;
    transition: all 0.27s ease;
}
.header #subHeader .inner .freeShippingContainer .shippingLines:before {
    content: "";
    display: block;
    height: 1px;
    width: 20px;
    background: #777;
    position: relative;
    top: 17px;
    left: 23px;
}
.header #subHeader .inner .freeShippingContainer .shippingLines:after {
    content: "";
    display: block;
    height: 1px;
    width: 25px;
    background: #777;
    position: relative;
    top: -21px;
    left: 18px;
}
.header #subHeader .inner .freeShippingContainer .shippingLines span {
    content: "";
    height: 1px;
    line-height: 40px;
    display: inline-block;
    vertical-align: middle;
    width: 19px;
    background: #eaeaea;
    position: relative;
    top: -3px;
    left: 19px;
    -webkit-transition: all 0.27s ease;
    -moz-transition: all 0.27s ease;
    -o-transition: all 0.27s ease;
    transition: all 0.27s ease;
}
.header #subHeader .inner .freeShippingContainer .shippingLines span:before {
    content: "";
    height: 1px;
    line-height: 40px;
    display: block;
    vertical-align: middle;
    width: 15px;
    background: #eaeaea;
    position: relative;
    top: -3px;
    left: 9px;
}
.header #subHeader .inner .freeShippingContainer .shippingLines span:after {
    content: "";
    height: 1px;
    line-height: 40px;
    display: block;
    vertical-align: middle;
    width: 25px;
    background: #eaeaea;
    position: relative;
    top: 2px;
    left: -8px;
}
.header #subHeader .inner .freeShippingContainer:hover .freeShippingText {
    color: #6ADA78;
}
#nav-cover {
	visibility: hidden;
	-ms-filter: opacity(0);
	filter: alpha(opacity=0);
	-webkit-opacity: 0;
	-moz-opacity: 0;
	-o-opacity: 0;
	opacity: 0;
	-webkit-transition: all 137ms;
	-moz-transition: all 137ms;
	-ms-transition: all 137ms;
	-o-transition: all 137ms;
	transition: all 137ms;
	position: absolute;
	top: 148px;
	left: 0;
	width: 100%;
	height: calc( 100% - 148px );
	background-color: #000;
	-webkit-transform: translate3d(0,0,0);
	-moz-transform: translate3d(0,0,0);
	-ms-transform: translate3d(0,0,0);
	-o-transform: translate3d(0,0,0);
	transform: translate3d(0,0,0);
	z-index: 4;
}
.modal-open #nav-cover {
	visibility: visible;
    -ms-filter: opacity(.5);
    filter: alpha(opacity=50);
    -webkit-opacity: .5;
    -moz-opacity: .5;
    -o-opacity: .5;
    opacity: .5;
}

.ProductList.MagicScroll li { min-height:auto !important; height:auto !important; }
.ProductList.MagicScroll li .ProductPriceRating { display:none; }

@media screen and (max-width: 480px) {
/* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
    .header #Header .headerSearchContainer {
        display: none;
    }
    .header #Header .inner #myAccountMenuTrigger {
        display: none;
    }
    .header #Header .inner .header-secondary {
        top: 12px;
        position: absolute;
    }
/* SubHeader Header - bottom section of three section header */
    #subHeader {
        display:none;
    }
/*     Front page */
    #home .MagicScroll-horizontal .mcs-item {
        width: 49% !important;
    }
}
@media screen and (max-width: 767px) {
/* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
    .header #Header .headerSearchContainer {
        display: none;
    }
    .header #Header .inner #myAccountMenuTrigger {
        display: none;
    }
    .header #Header .inner .header-secondary {
        top: 12px;
        position: absolute;
    }
/* SubHeader Header - bottom section of three section header */
    #subHeader {
        display:none;
    }
/*     Front page */
    #home .MagicScroll-horizontal .mcs-item {
        width: 49% !important;
    }
}
@media screen and (max-width: 768px) {
/* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
    .header #Header .headerSearchContainer {
        display: none;
    }
    .header #Header .inner #myAccountMenuTrigger {
        display: none;
    }
    .header #Header .inner .header-secondary {
        top: 12px;
        position: absolute;
    }
/* SubHeader Header - bottom section of three section header */
    #subHeader {
        display:none;
    }
/*     Front page */
    #home .MagicScroll-horizontal .mcs-item {
/*         width: 49% !important; */
    }
}
@media screen and (device-aspect-ratio: 2/3) {
    /* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
}

@media screen and (device-aspect-ratio: 40/71) {
    /* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
    .header #Header .headerSearchContainer {
        display: none;
    }
    .header #Header .inner #myAccountMenuTrigger {
        display: none;
    }
    .header #Header .inner .header-secondary {
        top: 12px;
    }
/* SubHeader Header - bottom section of three section header */
    #subHeader {
        display:none;
    }
}

@media screen and (device-aspect-ratio: 667/375) {
    /* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
    .header #Header .headerSearchContainer {
        display: none;
    }
    .header #Header .inner #myAccountMenuTrigger {
        display: none;
    }
    .header #Header .inner .header-secondary {
        top: 12px;
    }
/* SubHeader Header - bottom section of three section header */
    #subHeader {
        display:none;
    }
}

@media screen and (device-aspect-ratio: 16/9) {
    /* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
}

@media screen and (device-aspect-ratio: 3/4) {
    /* Top Header - top section of three section header */
/* Main Header - middle section of three section header */
    .header #Header {
        margin: 0;
    }
}

@media only screen and (device-width : 800px) and (orientation: portrait) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
@media only screen and (width : 603px) and (orientation: portrait) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
@media only screen and (width : 961px) and (orientation: landscape) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
/*– iPad 1Gen/2Gen iPad Mini, Kindle Fire –*/
@media only screen and (-webkit-min-device-pixel-ratio: 1) and (max-device-width:1024px) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
/*– Nexus 7 (2012)–*/
@media only screen and (-webkit-min-device-pixel-ratio: 1.325) and (max-device-width:1280px) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
/*– Nexus 7, Samsung Galaxy Note III, iPad 3 / 4 –*/
@media only screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width:1920px) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
/*– iPad 3Gen/4Gen, –*/
@media only screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width:2048px) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
/*– Macbook Pro 13″, Samsung Nexus 10 –*/
@media only screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width:2560px) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}
/*– Macbook Pro 15″ –*/
@media only screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width:2880px) {
	.header #Header .inner #myAccountTrigger {
		margin: 0 20px;
	}
}


text:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

namespace FineUI.Examples.autocomplete
{
    public partial class inline_window : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            labResult.Text = String.Format("输入值:{0}", TextBox1.Text);
        }

    }
}


text:
layout: page
title: Sellers 55th Anniversary
date: 2016-05-24
author: Russell Whitaker
tags: weekly links, java
status: published
summary: Mauris eu vulputate ipsum. Nullam sit amet neque ante. Vestibulum.
banner: images/banner/leisure-04.jpg
booking:
  startDate: 07/22/2018
  endDate: 07/24/2018
  ctyhocn: INDCWHX
  groupCode: S5A
published: true
---
Suspendisse pretium dolor vitae nunc tincidunt cursus. Ut malesuada, tellus sit amet laoreet tempor, neque justo facilisis ante, eget egestas dolor ante sed nisl. Vivamus ornare neque ipsum. Ut pulvinar imperdiet lacus, nec bibendum nulla facilisis a. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut ut augue nisl. Praesent lectus lorem, scelerisque ac egestas sed, euismod vitae leo.

* Maecenas eleifend dolor hendrerit ante pretium ultricies
* Praesent a lacus venenatis nisl interdum bibendum id et urna
* Pellentesque non nisl sit amet ex pulvinar efficitur
* Donec a felis at dolor luctus maximus ac a nisl.

Morbi fringilla, dolor ac aliquam cursus, elit ex rutrum urna, sed pulvinar leo eros ut ex. Donec blandit volutpat rutrum. Vestibulum tellus ipsum, rhoncus quis blandit quis, maximus quis lectus. Cras aliquet quam id congue sagittis. Duis neque felis, euismod et sagittis ut, aliquet et eros. Aliquam accumsan, odio at ornare ultrices, diam ex interdum nunc, vitae finibus leo nulla et nibh. Maecenas sed justo eget lacus consequat aliquam ut a odio. Maecenas tempor nisi id dictum laoreet. Fusce at vulputate est, ut facilisis lacus. Nam dignissim felis a dolor aliquam venenatis. Nulla vel purus eu elit molestie facilisis ut fermentum massa. Pellentesque at blandit lacus, et sagittis nisl. Morbi ultrices sit amet sem id pulvinar.


text:
<#
.SYNOPSIS
	The script scan Active Directory and retrieve huge data of many sources like:
	-User objects
	-Computer objects
	-Organizational Unit
	-Forest
	-Access control list
	-Etc.

	Ability to export data to CSV and Excel format. Default save format is CSV

.NOTES
	Author		: Juan Garrido (http://windowstips.wordpress.com)
	Twitter		: @tr1ana
	Company		: http://www.innotecsystem.com
	File Name	: voyeur.ps1

#>

#---------------------------------------------------
# Search for Roles
# Perform search of common Service Principal Names
#---------------------------------------------------

Function Get-Roles([String] $Filter)
	{
		$FinalObject = @()
		#Searcher
		if ($Global:Domain)
			{
				$Searcher = New-Object System.DirectoryServices.DirectorySearcher($Domain,$($credential.UserName),$($credential.GetNetworkCredential().password))
				$Searcher.SearchScope = "subtree"
			}
		elseif ($Global:DomainWPass)
			{
				$Searcher = New-Object System.DirectoryServices.DirectorySearcher($DomainWPass)
				$Searcher.SearchRoot = "LDAP://" + $DomainWPass
			}
		else
		{
			$Searcher = New-Object System.DirectoryServices.DirectorySearcher($CurrentDomain.distinguishedname)
			$Searcher.SearchRoot = "LDAP://" + $CurrentDomain.distinguishedname
		}
		$Searcher.PageSize = 200
        if ($Filter)
        {
            $Searcher.SearchRoot ="LDAP://$($Filter)"
        }
		Foreach ($service in $Services)
		{
			$spn = [String]::Format($service.SPN)
			$Searcher.filter = "(servicePrincipalName=$spn*/*)"
        	$Results = $Searcher.FindAll()
			if ($Results)
				{
					Write-Verbose "Role Service Found....."
					foreach ($r in $Results)
						{
							$account = $r.GetDirectoryEntry()
							$record = @{}
							$record.Add("Name", [String]$account.Name)
							$record.Add("AccountName", [String]$account.sAMAccountName)
							$record.Add("GUID", [String]$account.guid)
							$record.Add("DN", [String]$account.DistinguishedName)
							$record.Add("Service", [String]$service.Service)
							$FinalObject +=$record
						}
				}
		}
	$AllRoles = Set-PSObject $FinalObject "Arsenal.AD.Roles"
	return $AllRoles
	}


text:
classdef DegradationSystem < matlab.System %#codegen
    %DEGRADATIONSYSTEM Degradation system
    %
    % Requirements: MATLAB R2015b
    %
    % Copyright (c) 2014-2017, Shogo MURAMATSU
    %
    % All rights reserved.
    %
    % Contact address: Shogo MURAMATSU,
    %                Faculty of Engineering, Niigata University,
    %                8050 2-no-cho Ikarashi, Nishi-ku,
    %                Niigata, 950-2181, JAPAN
    %
    % http://msiplab.eng.niigata-u.ac.jp/
    %
    properties(Nontunable)
        LinearProcess
        NoiseProcess
    end

    methods
        % Constractor
        function obj = DegradationSystem(varargin)
            setProperties(obj,nargin,varargin{:});
        end
    end

    methods (Access = protected)

        function output = stepImpl(obj,input)
            output = step(obj.NoiseProcess,...
                step(obj.LinearProcess,input));
        end

        function validatePropertiesImpl(obj)
            % Check linear process
            if ~isa(obj.LinearProcess,'saivdr.degradation.linearprocess.AbstLinearSystem')
                error('SaivDr: Invalid linear process');
            elseif strcmp(get(obj.LinearProcess,'ProcessingMode'),'Adjoint')
                error('SaivDr: Processing mode should be Normal.');
            end

            % Check noise process
            if ~isa(obj.NoiseProcess,'saivdr.degradation.noiseprocess.AbstNoiseSystem')
                error('SaivDr: Invalid noise process');
            end
        end

        function N = getNumInputsImpl(~)
            N = 1;
        end

        function N = getNumOutputsImpl(~)
            N = 1;
        end
    end
end


text:
set -o pipefail
set -o nounset
set -o errexit

cd "$(dirname "$0")/.."
DOTFILES_ROOT=$(pwd -P)

source $DOTFILES_ROOT/script/linker_source

link_file $DOTFILES_ROOT/kitty/kitty.conf ~/.config/kitty/kitty.conf
link_file $DOTFILES_ROOT/kitty/dracula.conf ~/.config/kitty/dracula.conf
link_file $DOTFILES_ROOT/kitty/diff.conf ~/.config/kitty/diff.conf


text:
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"

fn_getopt_generic(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	u|update)
		command_update.sh;;
	fu|force-update|update-restart)
		forceupdate=1;
		command_update.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	v|validate)
		command_validate.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	pd|postdetails)
		command_postdetails.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update\t${default}u  |Checks and applies updates from SteamCMD."
		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
	} | column -s $'\t' -t
	esac
}

fn_getopt_generic_no_update(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	pd|postdetails)
		command_postdetails.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
	} | column -s $'\t' -t
	esac
}

fn_getopt_teamspeak3(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	u|update)
		command_update.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	pd|postdetails)
		command_postdetails.sh;;
	b|backup)
		command_backup.sh;;
	pw|change-password)
		command_ts3_server_pass.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update\t${default}u  |Checks and applies updates from teamspeak.com."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
		echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password."
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
	} | column -s $'\t' -t
	esac
}

fn_getopt_minecraft(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	u|update)
		command_update.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	pd|postdetails)
		command_postdetails.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update\t${default}u  |Checks and applies updates from mojang.com."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
	} | column -s $'\t' -t
	esac
}

fn_getopt_mumble(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	u|update)
		command_update.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	pd|postdetails)
		command_postdetails.sh;;
	b|backup)
		command_backup.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	c|console)
		command_console.sh;;
	i|install)
		command_install.sh;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update\t${default}u  |Checks and applies updates from GitHub."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
	} | column -s $'\t' -t
	esac
}

fn_getopt_dstserver(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	u|update)
		command_update.sh;;
	fu|force-update|update-restart)
		forceupdate=1;
		command_update.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	v|validate)
		command_validate.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	pd|postdetails)
		command_postdetails.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	ct|cluster-token)
		install_dst_token.sh;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update\t${default}u  |Checks and applies updates from SteamCMD."
		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
		echo -e "${blue}cluster-token\t${default}ct |Configure cluster token."
	} | column -s $'\t' -t
	esac
}

fn_getopt_gmodserver(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	u|update)
		command_update.sh;;
	fu|force-update|update-restart)
		forceupdate=1;
		command_update.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	v|validate)
		command_validate.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	pd|postdetails)
		command_postdetails.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	fd|fastdl)
		command_fastdl.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update\t${default}u  |Checks and applies updates from SteamCMD."
		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
		echo -e "${blue}fastdl\t${default}fd |Generates or update a FastDL directory for your server."
	} | column -s $'\t' -t
	esac
}

fn_getopt_unreal(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	mc|map-compressor)
		compress_ut99_maps.sh;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
		echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
	} | column -s $'\t' -t
	esac
}

fn_getopt_unreal2(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	u|update)
		command_update.sh;;
	fu|force-update|update-restart)
		forceupdate=1;
		command_update.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	v|validate)
		command_validate.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	mc|map-compressor)
		compress_unreal2_maps.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}validate\t${default}v  |Validate server files with SteamCMD."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
		echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
	} | column -s $'\t' -t
	esac
}

fn_getopt_ut2k4(){
case "${getopt}" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		command_restart.sh;;
	uf|update-functions)
		command_update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	ta|test-alert)
		command_test_alert.sh;;
	dt|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	cd|server-cd-key)
		install_ut2k4_key.sh;;
	mc|map-compressor)
		compress_unreal2_maps.sh;;
	dd|detect-deps)
		command_dev_detect_deps.sh;;
	dg|detect-glibc)
		command_dev_detect_glibc.sh;;
	dl|detect-ldd)
		command_dev_detect_ldd.sh;;
	*)
	if [ -n "${getopt}" ]; then
		echo -e "${red}Unknown command${default}: $0 ${getopt}"
		exitcode=2
	fi
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "https://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "${lightyellow}Commands${default}"
	{
		echo -e "${blue}start\t${default}st |Start the server."
		echo -e "${blue}stop\t${default}sp |Stop the server."
		echo -e "${blue}restart\t${default}r  |Restart the server."
		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
		echo -e "${blue}test-alert\t${default}ta |Sends test alert."
		echo -e "${blue}details\t${default}dt |Displays useful information about the server."
		echo -e "${blue}backup\t${default}b  |Create archive of the server."
		echo -e "${blue}console\t${default}c  |Console allows you to access the live view of a server."
		echo -e "${blue}debug\t${default}d  |See the output of the server directly to your terminal."
		echo -e "${blue}install\t${default}i  |Install the server."
		echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
		echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
		echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
	} | column -s $'\t' -t
	esac
}

if [ "${gamename}" == "Mumble" ]; then
	fn_getopt_mumble
elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
	fn_getopt_generic_no_update
elif [ "${engine}" == "lwjgl2" ]; then
	fn_getopt_minecraft
elif [ "${gamename}" == "TeamSpeak 3" ]; then
	fn_getopt_teamspeak3
elif [ "${gamename}" == "Don't Starve Together" ]; then
	fn_getopt_dstserver
elif [ "${gamename}" == "Garry's Mod" ]; then
	fn_getopt_gmodserver
elif [ "${engine}" == "unreal2" ]; then
	if [ "${gamename}" == "Unreal Tournament 2004" ]; then
		fn_getopt_ut2k4
	else
		fn_getopt_unreal2
	fi
elif [ "${engine}" == "unreal" ]; then
	fn_getopt_unreal
else
	fn_getopt_generic
fi
core_exit.sh


text:
package org.apache.camel.component.microprofile.metrics.event.notifier;

import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.microprofile.metrics.MicroProfileMetricsHelper;
import org.apache.camel.spi.CamelEvent;
import org.apache.camel.support.EventNotifierSupport;
import org.apache.camel.support.service.ServiceHelper;
import org.eclipse.microprofile.metrics.MetricRegistry;

public abstract class AbstractMicroProfileMetricsEventNotifier<T extends CamelEvent> extends EventNotifierSupport
        implements CamelContextAware {

    private final Class<T> eventType;

    private CamelContext camelContext;
    private MetricRegistry metricRegistry;

    public AbstractMicroProfileMetricsEventNotifier(Class<T> eventType) {
        this.eventType = eventType;
    }

    @Override
    public void setCamelContext(CamelContext camelContext) {
        this.camelContext = camelContext;
    }

    @Override
    public CamelContext getCamelContext() {
        return camelContext;
    }

    public MetricRegistry getMetricRegistry() {
        return metricRegistry;
    }

    public void setMetricRegistry(MetricRegistry metricRegistry) {
        this.metricRegistry = metricRegistry;
    }

    @Override
    public boolean isEnabled(CamelEvent eventObject) {
        return eventType.isAssignableFrom(eventObject.getClass());
    }

    @Override
    protected void doStart() throws Exception {
        super.doStart();

        if (metricRegistry == null) {
            metricRegistry = MicroProfileMetricsHelper.getMetricRegistry(camelContext);
        }

        try {
            MicroProfileMetricsEventNotifierService service
                    = camelContext.hasService(MicroProfileMetricsEventNotifierService.class);
            if (service == null) {
                service = new MicroProfileMetricsEventNotifierService();
                service.setMetricRegistry(getMetricRegistry());
                camelContext.addService(service);
                ServiceHelper.startService(service);
            }
        } catch (Exception e) {
            throw RuntimeCamelException.wrapRuntimeCamelException(e);
        }
    }
}


text:
module Blorgh
  module BiomedHelper
  end
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta http-equiv="X-UA-Compatible" content="IE=11"/>

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="robots"    content="index, follow" />

    <meta name="description" content="Hello, My Name is Lucas Gatsas, I'm a Front End Engineer and Web Developer from Switzerland. This is my Personal Notice and Archive Work Experience Work Blog. My Official Website will be Up soon! Code and Space!">

    <meta name="keywords" content="Lucas Gatsas, Gatsas, Web Developer, Front End Engineer">

    <link rel="shortcut icon" href="https://lucasgatsas.ch/img/favicon-7326478236.png" type="image/x-icon" />

    <title>Lucas Gatsas - Web Developer & Front-End Engineer from Switzerland. </title>

    <meta property="og:image" content="https://lucasgatsas.ch/img/93TyTG3x.png"/>
    <meta property="og:title" content="Hello, My Name is Lucas Gatsas, I'm a Front End Engineer and Web Developer from Switzerland. This is my Personal Notice and Archive Work Experience Work Blog. My Official Website will be Up soon! Code and Space!"/>
    <meta property="og:site_name" content="Hello, My Name is Lucas Gatsas, I'm a Front End Engineer and Web Developer from Switzerland. This is my Personal Notice and Archive Work Experience Work Blog. My Official Website will be Up soon! Code and Space!"/>

    <link rel="canonical" href="https://lucasgatsas.ch/2015/01/17/sails.js/">

    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/spaceg.stylesheets.css">

    <link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Playfair+Display:400,700,900,400italic,700italic,900italic' rel='stylesheet' type='text/css'>

    <link href="https://gist-assets.github.com/assets/embed-b67021dc07195830cc157f7720b938fb.css" rel="stylesheet" type="text/css">

<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    Toggle navigation

                </button>

            g

LucasGatsas

Lucas Gatsas

                                Hello, my name is Lucas Gatsas, I'm a Front End Engineer

                                and Web Developer from Switzerland. This is my Personal Notice and Archive Work Experience Work Blog. My Official Website will be Up soon!

                                follow me.

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

l.g

                        follow.

Home

About Me

Archive

                            <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button>

Implement Passport.js authentication with Sails.js ~0.10

Passport.js and sails.js

                    Posted by Lucas Gatsas

sailsjs, passportjs, nodejss

Step 1: dependencies
Add these dependencies to the yourproject/package.json file:

...
  "dependencies": {
    ...
    "bcrypt": "~0.8.0",
    "passport": "~0.2.1",
    "passport-local": "~1.0.0",
    ...
   }
...

Open the terminal, go to your project folder and run:

[sudo] npm install

Step 2: create user model
To create a user model run the following command:

sails generate api user

This will automatically create a model and a controller. You can find the model at yourproject/api/models/User.js. Let's make that file look like this:

var bcrypt = require('bcrypt');

module.exports = {
    attributes: {
        email: {
            type: 'email',
            required: true,
            unique: true
        },
        password: {
            type: 'string',
            minLength: 6,
            required: true
        },
        toJSON: function() {
            var obj = this.toObject();
            delete obj.password;
            return obj;
        }
    },
    beforeCreate: function(user, cb) {
        bcrypt.genSalt(10, function(err, salt) {
            bcrypt.hash(user.password, salt, function(err, hash) {
                if (err) {
                    console.log(err);
                    cb(err);
                } else {
                    user.password = hash;
                    cb();
                }
            });
        });
    }
};

Step 3: create AuthController
Run this command from your terminal:
sails generate controller auth

Then go to yourproject/api/controllers/AuthController.js and alter it in this way:

var passport = require('passport');

module.exports = {

    _config: {
        actions: false,
        shortcuts: false,
        rest: false
    },

    login: function(req, res) {

        passport.authenticate('local', function(err, user, info) {
            if ((err) || (!user)) {
                return res.send({
                    message: info.message,
                    user: user
                });
            }
            req.logIn(user, function(err) {
                if (err) res.send(err);
                return res.send({
                    message: info.message,
                    user: user
                });
            });

        })(req, res);
    },

    logout: function(req, res) {
        req.logout();
        res.redirect('/');
    }
};

Step 4: create login and signup views
Create this file yourproject/views/signup.ejs:

<h1>Signup</h1>
<form method="POST" action="/user">
  <input type="email" name="email">
  <input type="password" name="password">
  <input type="submit" value="submit">
</form>

And then this yourproject/views/login.ejs:

<h1>Login</h1>
  <form method="POST" action="/login">
  <input type="email" name="email">
  <input type="password" name="password">
  <input type="submit" value="submit">
</form>

These forms look the same, besides the action.

Step 5: configuring the routes
Let's set up our routes in yourproject/config/routes.js like this:

module.exports.routes = {
  '/': {
    view: 'homepage'
  },

  'get /login': {
       view: 'login'
  },

  'post /login': 'AuthController.login',

  '/logout': 'AuthController.logout',

  'get /signup': {
    view: 'signup'
  }
};

If you notice we are leveraging HTTP verbs, we have two login actions but different routes.

Step 6: configuring Express Middleware
Since we are using Passport we have to customize our middleware in yourproject/config/http.js:

module.exports.http = {
   middleware: {

    passportInit    : require('passport').initialize(),
    passportSession : require('passport').session(),

     order: [
            'startRequestTimer',
            'cookieParser',
            'session',
            'passportInit',
            'passportSession',
            'myRequestLogger',
            'bodyParser',
            'handleBodyParserError',
            'compress',
            'methodOverride',
            'poweredBy',
            'router',
            'www',
            'favicon',
            '404',
            '500'
          ],
     }
};

Into the order array we added passportInit and passportSession after the session element. The name of this array is quite self-explanatory, the elements must be ordered this way.

Step 7: define Passport local strategy for authentication
Into yourproject/config/ folder let's create a new file called passport.js:

var passport = require('passport'),
LocalStrategy = require('passport-local').Strategy,
bcrypt = require('bcrypt');

passport.serializeUser(function(user, done) {
    done(null, user.id);
});

passport.deserializeUser(function(id, done) {
    User.findOne({ id: id } , function (err, user) {
        done(err, user);
    });
});

passport.use(new LocalStrategy({
    usernameField: 'email',
    passwordField: 'password'
  },
  function(email, password, done) {

    User.findOne({ email: email }, function (err, user) {
      if (err) { return done(err); }
      if (!user) {
        return done(null, false, { message: 'Incorrect email.' });
      }

      bcrypt.compare(password, user.password, function (err, res) {
          if (!res)
            return done(null, false, {
              message: 'Invalid Password'
            });
          var returnUser = {
            email: user.email,
            createdAt: user.createdAt,
            id: user.id
          };
          return done(null, returnUser, {
            message: 'Logged In Successfully'
          });
        });
    });
  }
));

Step 8: add a new policy
Let's create a new policy isAuthenticated.js into the yourproject/api/policies/ folder:

module.exports = function(req, res, next) {
   if (req.isAuthenticated()) {
        return next();
    }
    else{
        return res.redirect('/login');
    }
};

Briefly, we are telling Sails what to do if a user is not authenticated, then we can bind this policy to any of the controllers in the app.

Step 9: bind the policy to a controller
Let's create a controller and a model just for testing what we have done. I am going to call this api post.

sails generate api post

Then let's bind the policy to the PostController by updating yourproject/config/policies.js:

module.exports.policies = {

   '*': true,

  'PostController': {
    '*': 'isAuthenticated'
  },

};

Now the 'GET /post' route (and all the other routes automatically generated for this controller ) is available only to authenticated users.

Step 10: run a test
Lift your application
sails lift
And then go and play with these routes:

http://localhost:1337/post - the very first time it should redirect you to the login page

go to http://localhost:1337/signup for signing up

go to http://localhost:1337/login for logging in

now you should be able to access this page http://localhost:1337/post, even though it's going to show you just an empty array (there aren't any posts yet)

go to http://localhost:1337/logout for logging out

→ Get the repository on Github

I would very much appreciate your comments, especially if you find an error or you need a further explanation.
References:

→ Sails.js
→ Passport.js
→ Waterline

When in doubt, use brute force.

        — Ken Thompson

                        ← Previous Post

                        Next Post →

Copyright © l.g 2015 - 2016.
 2014, 2015

 Running with

    ICE & FIRE Theme by Lucas Gatsas. Hosted on  Github


text:
"""
Copyright (c) 2009 Barry Schwartz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

import fontforge
from os.path import exists

#--------------------------------------------------------------------------

def merge_pair_positioning_subtables(font):
    for lookup in font.gpos_lookups:
        if font.getLookupInfo(lookup)[0] == 'gpos_pair':
            subtables = font.getLookupSubtables(lookup)
            i = 0
            while i < len(subtables) and font.isKerningClass(subtables[i]):
                i += 1
            for subtab in subtables[i + 1:]:
                if not font.isKerningClass(subtab):
                    font.mergeLookupSubtables(subtables[i], subtab)

#--------------------------------------------------------------------------

def feature_file_exists(bitbucket, font):
    feature_file_name = font.fontname + "_main.fea"
    return exists(feature_file_name)

def read_features(bitbucket, font):
    feature_file_name = font.fontname + "_main.fea"
    font.mergeFeature(feature_file_name)
#    merge_pair_positioning_subtables(font) # FIX/TODO: This seems to trigger a metrics view bug in FontForge.
#                                           # I need to investigate and report. Meanwhile, put the call in
#                                           # make-fonts.py, or just not bother.

def erase_and_read_features(bitbucket, font):
    all_lookups = font.gpos_lookups + font.gsub_lookups
    for lookup in all_lookups:
        if font.getLookupInfo(lookup)[0] != 'gpos_mark2base':
            font.removeLookup(lookup)
    read_features(bitbucket, font)
    font.buildOrReplaceAALTFeatures()

fontforge.registerMenuItem(erase_and_read_features,
                           feature_file_exists, None, "Font", "None",
                           "Delete lookups and read _main feature file")

#--------------------------------------------------------------------------


text:
{% if page.no_hero != true %}

                        In action

                        Weighted overlay

                        Try adjusting the weights below to find your ideal location. If you want to avoid rail stops, give them a negative weight. If you prefer bars, give them a positive weight.

                                Bars

                            <input type="text" id="controller-1-amount-1" class="demo-amount demo-controller__input" disabled>

                                Grocery stores

                            <input type="text" id="controller-1-amount-2" class="demo-amount demo-controller__input" disabled>

                                Rail stops

                            <input type="text" id="controller-1-amount-3" class="demo-amount demo-controller__input" disabled>

                        In action

                        Hillshade

                        The GeoTrellis hillshade operation computes the illumination angle and shadows of a surface given a light source. Try adjusting the position or altitude of the sun.

                                Altitude

                                N

                       Avoid

                       Prefer

{% endif %}


text:
namespace media {

class VideoCaptureDeviceChromeOSDelegate;

// Implementation of VideoCaptureDevice for ChromeOS with CrOS camera HALv3.
class CAPTURE_EXPORT VideoCaptureDeviceChromeOSHalv3 final
    : public VideoCaptureDevice {
 public:
  VideoCaptureDeviceChromeOSHalv3(
      VideoCaptureDeviceChromeOSDelegate* delegate,
      const VideoCaptureDeviceDescriptor& vcd_descriptor);

  ~VideoCaptureDeviceChromeOSHalv3() final;

  // VideoCaptureDevice implementation.
  void AllocateAndStart(const VideoCaptureParams& params,
                        std::unique_ptr<Client> client) final;
  void StopAndDeAllocate() final;
  void TakePhoto(TakePhotoCallback callback) final;
  void GetPhotoState(GetPhotoStateCallback callback) final;
  void SetPhotoOptions(mojom::PhotoSettingsPtr settings,
                       SetPhotoOptionsCallback callback) final;

 private:
  VideoCaptureDeviceChromeOSDelegate* vcd_delegate_;

  ClientType client_type_;

  DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceChromeOSHalv3);
};

}  // namespace media

#endif  // MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_CHROMEOS_HALV3_H_


text:
>  Introduces a new ? token in an argument list which allows for partially applying an argument list to a call expression.

See our website [@babel/plugin-proposal-partial-application](https://babeljs.io/docs/en/next/babel-plugin-proposal-partial-application.html) for more information.

## Install

Using npm:

```sh
npm install --save-dev @babel/plugin-proposal-partial-application
```

or using yarn:

```sh
yarn add @babel/plugin-proposal-partial-application --dev
```


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epi.Cloud.Common.BusinessObjects;
using Epi.Cloud.Resources.Constants;
using System.Globalization;
using System.Resources;
using System.Collections;

namespace Epi.Cloud.Resources
{
    public static class DataAccessessRulesHelper
    {
        public static void GetDataAccessRules(out Dictionary<int, string> dataAccessRuleIds, out Dictionary<string, string> dataAccessRuleDescriptions)
        {
            dataAccessRuleIds = new Dictionary<int, string>();
            dataAccessRuleDescriptions = new Dictionary<string, string>();

            var ruleId = 0;
            string ruleName;
            string ruleDescription;
            var resourceManager = ResourceProvider.GetResourceManager(ResourceNamespaces.DataAccessRules);
            ResourceSet resourceSet= resourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);

            foreach (DictionaryEntry entry in resourceSet.OfType<DictionaryEntry>().OrderBy(i => i.Key))
            {
                ruleId++;
                dataAccessRuleIds.Add(ruleId, entry.Key.ToString());
                dataAccessRuleDescriptions.Add(entry.Key.ToString(), entry.Value.ToString());
            }
        }

        public static void GetDataAccessRules(List<FormSettingBO> formSettingBOList)
        {
            Dictionary<int, string> dataAccessRuleIds = new Dictionary<int, string>();
            Dictionary<string, string> dataAccessRuleDescriptions = new Dictionary<string, string>();
            GetDataAccessRules(out dataAccessRuleIds, out dataAccessRuleDescriptions);
            foreach (var formSettingBO in formSettingBOList)
            {
                formSettingBO.DataAccessRuleDescription = dataAccessRuleDescriptions;
                formSettingBO.DataAccessRuleIds = dataAccessRuleIds;
            }
        }

        public static FormSettingBO GetDataAccessRules(FormSettingBO formSettingBO)
        {
            Dictionary<int, string> dataAccessRuleIds = new Dictionary<int, string>();
            Dictionary<string, string> dataAccessRuleDescriptions = new Dictionary<string, string>();
            GetDataAccessRules(out dataAccessRuleIds, out dataAccessRuleDescriptions);
            formSettingBO.DataAccessRuleDescription = dataAccessRuleDescriptions;
            formSettingBO.DataAccessRuleIds = dataAccessRuleIds;
            return formSettingBO;
        }
    }
}


text:
package title.source.game.search.utils;

public interface ItemCallback<T> {
    void onItemClick(T t);
}


text:
require 'spec_helper'

describe TemplatesController do

  let(:fake_user) { double(:fake_user) }
  let(:fake_app) { double(:fake_app, id: 7, write_attributes: true, save: true) }
  let(:fake_types) { double(:fake_types) }
  let(:fake_template) { double(:fake_template, id: 1) }
  let(:fake_template_form) do
    double(:fake_template_form, repo: 'foo/bar', save: true, app_id: 7, documentation: 'some docs')
  end

  before do
    Template.stub(:find).and_return(fake_template)
    User.stub(:find).and_return(fake_user)
    TemplateForm.stub(:new).and_return(fake_template_form)
    App.stub(:find).and_return(fake_app)
    Type.stub(:all).and_return(fake_types)
    fake_user.stub(:github_access_token_present?)
    fake_user.stub(:has_valid_github_creds?)
    fake_user.stub(:has_invalid_github_creds?)
  end

  describe 'GET #new' do
    it 'hydrates the template form with a user, types, and app_id' do
      expect(TemplateForm).to receive(:new).with(
        types: fake_types,
        user: fake_user,
        app: fake_app
      )
      get :new, app_id: 7
    end

    it 'renders the new view' do
      get :new
      expect(response).to render_template :new
    end

    it 'looks up and assign the user' do
      get :new
      expect(assigns(:user)).to eq fake_user
    end

    it 'assigns a template form' do
      get :new
      expect(assigns(:template_form)).to eq fake_template_form
    end

    context 'when an app cannot be found' do
      before do
        App.stub(:find).and_raise(ActiveResource::ResourceNotFound.new(double('err', code: '404')))
      end

      it 'redirects to the apps page with a flash message' do
        get :new
        expect(flash[:alert]).to eq 'could not find application'
        expect(response).to redirect_to(apps_path)
      end
    end

    context 'when the user comes in for the first time' do
      before do
        fake_user.stub(:has_valid_github_creds?).and_return(false)
        fake_user.stub(:has_invalid_github_creds?).and_return(false)
      end

      it 'renders the new view without any error message' do
        get :new
        expect(flash[:alert]).to be_nil
        expect(response).to render_template :new
      end

    end

    context 'when user github creds are not valid' do
      expected_flash_msg = "Your token may be malformed, expired or is not scoped correctly."
      before do
        fake_user.stub(:has_invalid_github_creds?).and_return(true)
        fake_user.stub(:has_valid_github_creds?).and_return(false)
      end

      it 'renders the new view with a flash error message' do
        get :new
        expect(flash[:alert]).to include(expected_flash_msg)
        expect(response).to render_template :new
      end

    end

  end

  describe 'POST #create' do

    let(:create_params) do
      {
        'name' => 'My template',
        'repo' => 'foo/bar',
        'app_id' => '7',
        'documentation' => 'some docs'
      }
    end

    it 'assigns a template form with the supplied parameters' do
      expect(TemplateForm).to receive(:new).with(create_params).and_return(fake_template_form)
      post :create, 'template_form' => create_params
      expect(assigns(:template_form)).to eq fake_template_form
    end

    it 'updates the app with the new documentation' do
      expect(App).to receive(:find).with(fake_template_form.app_id).and_return(fake_app)
      expect(fake_app).to receive(:write_attributes)
                          .with(documentation: fake_template_form.documentation)
                          .and_return(true)
      expect(fake_app).to receive(:save).and_return(true)
      post :create, 'template_form' => create_params
    end

    context 'when saving is successful' do
      before do
        fake_template_form.stub(:save).and_return(true)
      end

      it 'sets a successful flash message' do
        post :create, 'template_form' => create_params
        expect(flash[:success]).to eq 'Template successfully created.'
      end

      it 'redirects to the applications path' do
        post :create, 'template_form' => create_params
        expect(response).to redirect_to apps_path
      end

      it 'adds the repo to the template_repo sources' do
        expect(TemplateRepo).to receive(:find_or_create_by_name).with(create_params['repo'])
        post :create, 'template_form' => create_params
      end

    end

    context 'when saving is not successful' do
      before do
        fake_template_form.stub(:save).and_return(false)
        fake_template_form.stub(:errors).and_return(['some stuff'])
        fake_template_form.stub(:user=).and_return(true)
        fake_template_form.stub(:types=).and_return(true)
      end

      it 'looks up and assigns the user' do
        post :create
        expect(assigns(:user)).to eq fake_user
      end

      it 're-renders the templates#new view' do
        post :create, 'template_form' => create_params
        expect(response).to render_template :new
      end

      it 'does not add the repo to the template_repo sources' do
        expect(TemplateRepo).to_not receive(:find_or_create_by_name)
        post :create, 'template_form' => create_params
      end

    end

    context 'for template_repo' do
      it 'invokes create unless repo already exists' do
        expect(TemplateRepo).to_not receive(:create).with(name: 'user/publicrepo')
        post :create, name: 'user/publicrepo'
      end
    end
  end

  describe 'GET #details' do
    it 'assigns the template' do
      get :details, id: 1
      expect(assigns(:template)).to eq fake_template
      expect(assigns(:template).id).to eq 1
    end
    it 'renders the details view' do
      get :details, id: 1
      expect(response).to render_template :details
    end
    it 'renders without a layout' do
      get :details, id: 1
      expect(response).to render_template(layout: nil)
    end
  end
end


text:
I just ported CuraEngine to browser using Emscripten.

[Linky](http://yifangu.com/cura-emscripten/)

You will be greeted by a terminal emulator which supports a very minimal set of instructions [cd, ls, pwd, rm, rmdir, cura, download].

After loading necessary files using the load button above, you can use CuraEngine just like normal.

After you're done with everything. Issue a `download <your-file>` command to download the generated gcode.

Note that the VM has only 64MB of memory which is shared between the runtime and the filesystem.

![ScreenShot](cura_browser.png)


text:
package node

import (
	"bufio"
	"errors"
	"fmt"
	"os"
	"os/exec"
	"regexp"
	"strings"

	docopt "github.com/docopt/docopt-go"
	goversion "github.com/mcuadros/go-version"
	log "github.com/sirupsen/logrus"
)

// The minimum allowed linux kernel version is 2.6.24, which introduced network
// namespaces and veth pairs.
const minKernelVersion = "2.6.24"

// Required kernel modules to run Calico
var requiredModules = []string{"xt_set", "ip6_tables"}

// Checksystem checks host system for compatible versions
func Checksystem(args []string) {
	doc := `Usage:
  calicoctl node checksystem

Options:
  -h --help                 Show this screen.

Description:
  Check the compatibility of this compute host to run a Calico node instance.
`

	parsedArgs, err := docopt.Parse(doc, args, true, "", false, false)
	if err != nil {
		fmt.Printf("Invalid option: 'calicoctl %s'. Use flag '--help' to read about a specific subcommand.\n", strings.Join(args, " "))
		os.Exit(1)
	}
	if len(parsedArgs) == 0 {
		return
	}

	// Make sure the command is run with super user privileges
	enforceRoot()

	systemOk := true

	fmt.Print("Checking kernel version...\n")
	err = checkKernelVersion()
	if err != nil {
		systemOk = false
	}

	fmt.Print("Checking kernel modules...\n")
	err = checkKernelModules()
	if err != nil {
		systemOk = false
	}

	// If any of the checks fail, print a message and exit
	if !systemOk {
		fmt.Printf("System doesn't meet one or more minimum systems requirements to run Calico\n")
		os.Exit(1)
	}

	fmt.Printf("System meets minimum system requirements to run Calico!\n")
}

// checkKernelVersion checks for minimum required kernel version
func checkKernelVersion() error {
	kernelVersion, err := exec.Command("uname", "-r").Output()
	if err != nil {
		printResult("", "FAIL")
		fmt.Printf("Error executing command: %s\n", err)
		return err
	}

	// To strip the trailing `\n`
	kernelVersionStr := strings.TrimSpace(string(kernelVersion))

	// Goversion normalizes the versions and compares them returns `true` if
	// running version is >= minimum version
	if !goversion.CompareNormalized(kernelVersionStr, minKernelVersion, ">=") {

		// Prints "FAIL" if current version is not >= minimum required version
		printResult(kernelVersionStr, "FAIL")
		fmt.Printf("Minimum kernel version to run Calico is %s. Detected kernel version: %s", minKernelVersion, string(kernelVersion))
		return errors.New("Kernel version mismatch")
	}

	// Prints "OK" if current version is >= minimum required version
	printResult(kernelVersionStr, "OK")

	return nil
}

// checkKernelModules checks for all the required kernel modules in the system
func checkKernelModules() error {

	kernelVersion, err := exec.Command("uname", "-r").Output()
	if err != nil {
		fmt.Printf("Error executing command: %s\n", err)
		return err
	}

	// To strip the trailing `\n`
	kernelVersionStr := strings.TrimSpace(string(kernelVersion))

	// File path to Loadable kernel modules
	modulesLoadablePath := fmt.Sprintf("/lib/modules/%s/modules.dep", kernelVersionStr)

	// File path to Builtin kernel modules
	modulesBuiltinPath := fmt.Sprintf("/lib/modules/%s/modules.builtin", kernelVersionStr)

	// Keep track of modules that are not found
	modulesNotFound := []string{}

	// Execute lsmod and cache the result
	lsmodOut, err := exec.Command("lsmod").Output()
	if err != nil {
		fmt.Printf("Error executing command: %s\n", err)
		return err
	}

	// Go through all the required modules and check Loadable and Builtin in order
	for _, v := range requiredModules {
		err = checkModule(modulesLoadablePath, v, kernelVersionStr)

		// Check Builtin modules if not found in Loadable
		if err != nil {
			err = checkModule(modulesBuiltinPath, v, kernelVersionStr)

			// Check if it's in lsmod, if not found in Builtin either
			if err != nil {

				regex, err := regexp.Compile(v)
				if err != nil {
					log.Errorf("Error: %v\n", err)
					return err
				}

				if !regex.MatchString(string(lsmodOut)) {
					fmt.Printf("WARNING: Unable to detect the %s module as Loaded/Builtin module or lsmod\n", v)
					modulesNotFound = append(modulesNotFound, v)
					printResult(v, "FAIL")
				} else {
					printResult(v, "OK")
				}
			} else {
				printResult(v, "OK")
			}
		} else {
			printResult(v, "OK")
		}
	}

	// If there are still any modules not found then return an error
	if len(modulesNotFound) > 0 {

		// ip6_tables is not a required module for ipv4 setups, so just print
		// a warning instead of failing the system check
		if len(modulesNotFound) == 1 && modulesNotFound[0] == "ip6_tables" {
			fmt.Printf("WARNING: IPv6 will be unavailable as ip6_tables kernel module is not found\n")
			return nil
		}
		return errors.New("One of more kernel modules missing")
	}

	return nil
}

// checkModule is a utility function used by `checkKernelModules`
// it opens the file provided and checks if the module passed in
// as an argument exists for the provided kernelVersion
func checkModule(filename, module, kernelVersion string) error {

	regex, err := regexp.Compile(fmt.Sprintf("\\/%s.ko", module))
	if err != nil {
		log.Errorf("Error: %v\n", err)
		return err
	}

	fh, err := os.Open(filename)
	if err != nil {
		log.Errorf("Error: %v\n", err)
		return err
	}

	f := bufio.NewReader(fh)
	defer fh.Close()

	for {
		// Ignoring second output (isPrefix) since it's not necessory
		buf, _, err := f.ReadLine()
		if err != nil {
			// EOF without a match
			return errors.New("Module not found")
		}

		if regex.MatchString(string(buf)) {
			return nil
		}
	}
}

func printResult(val, result string) {
	fmt.Printf("\t\t%-20s\t\t\t\t\t%s\n", val, result)
}