Skip to content

Instantly share code, notes, and snippets.

View abisz's full-sized avatar

Simon Reinsperger abisz

View GitHub Profile

Keybase proof

I hereby claim:

  • I am abisz on github.
  • I am simon_rsp (https://keybase.io/simon_rsp) on keybase.
  • I have a public key ASB3LFS-HnRtTQpEoIfXMBM7JuZlKEuAh4kvWlDWr54dcAo

To claim this, I am signing this object:

@abisz
abisz / perceptron.R
Created February 7, 2017 16:48
This is a basic example of machine learning. The algorithm is a perceptron learning algorithm. The data set to learn is artificially created.
# creating an artificial target function
# in a real machine learning application this would, of course, be unkown
target <- function(x) {
if (x[1] + x[2] > -5) {
return(-1)
} else {
return(1)
}
}
@abisz
abisz / route-parameter.js
Created September 30, 2016 12:42
Example how to pass parameters with ngRoute in Angular 1.x
$routeProvider.when('details/:id', {
     templateUrl: 'partials/details.html',
     controller: 'DetailController'
});
myApp.controller('DetailController', ['$scope', '$routeParams', function($scope, $routeParams){
     $scope.message = "Your ID is " + $routeParams.id;
}]);
@abisz
abisz / angular-router.js
Created September 30, 2016 12:41
Example of ngRouter in Angular 1.x
myApp.config('$routeProvider', function($routeProvider) {
  $routeProvider.
  when('/first', {
     templateUrl : 'partials/first.html'
    controller: "FirstController"
}).
when('/second', {
     templateUrl: 'partials/second.html'
    controller: "SecondController"
  }).
//if user is logged in the login link (last child in the primary menu) shouldn't be visible
body.logged-in ul#primary-menu{
  li:last-child{
    display:none;
  }
  //second last is now the last child
  li:nth-last-child(2) a{
    border-bottom: none;
  }
}
@media screen and (min-width: 37.5em) {
.menu-toggle{
display: none;
}
.main-navigation{
ul#primary-menu{
display: block;
border:none;
box-shadow: none;
//this should be at the beginning of your styles
//MemberMenu not visible if not logged in
#member-menu,
#toggle-member{
  display: none;
}
//show member menu if logged in
body.logged-in #member-menu,
body.logged-in #toggle-member{
wp_enqueue_style('fontawesome', "<a href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css</a>");
//showing the menus depending which class was appended to the container
.main-navigation.toggled #primary-menu,
.main-navigation.toggle-member #member-menu{
display:block;
}
/* Small menu. */
button.menu-toggle{
float:right;
background-color: transparent;
border:none;
box-shadow: none;
padding:0;
margin: 10px;
}