Skip to content

Instantly share code, notes, and snippets.

@alber70g
alber70g / entity.routing.ts
Last active November 9, 2015 16:19
AngularJS: Using partial html for Forms
module app {
'use strict';
angular
.module('app.entity')
.config(routes);
routes.$inject = ['$stateProvider'];
@alber70g
alber70g / BaseEntity.cs
Created July 3, 2015 09:09
Sample c# extension method for Trait in php
public class BaseEntity {
public Guid Guid { get; set; }
public int Id { get; set; }
}
@alber70g
alber70g / README.md
Last active March 6, 2017 10:01
Visual Studio Code (VS Code) shell script for use with Git Bash

VS Code Shell Shortcut for Git Bash

Put this file code in C:\Users\<username>\AppData\Local\Code\bin aside code.cmd.

Assuming this path is already in your %PATH% you can now run the command to open a file

code file.txt
@alber70g
alber70g / README.md
Last active June 25, 2018 10:43
Reddit Quick Popularity Identification with Colors based on Vote Count

Reddit Quick Popularity Identification with Colors based on Vote Count

How to install

Reddit Votes Colors

@alber70g
alber70g / directoryStructure.md
Last active August 29, 2015 14:16
Proposed directory structure

@laravelphp is there a way to change directory structure? I'd like to have functional based separation instead of a technical separation.

This way you don't have to switch between directories like cd ../../../resources/views/<ControllerName> to get to your views.

Http

  • Controllers
    • ControllerNameController
      • ControllerNameController.php
      • Views
        • ViewName1.blade.php
var allowed = new string[] {"<b>", "</b>", "<strong>", "</strong>", "<em>", "</em>"};
var tekst = "Dit is mijn tekst met een <b>dikgedrukte tekst</b>";
var nieuweTekst = tekst;
for (int tagNumber = 0; tagNumber < allowed.Length; tagNumber++)
{
nieuweTekst = nieuweTekst.Replace(allowed[tagNumber], "{" + tagNumber + "}");
}
@alber70g
alber70g / elevatorsaga.js
Last active August 29, 2015 14:14
http://play.elevatorsaga.com script. To get the ones with 'order less than' you can
{
init: function(elevators, floors) {
var floorsWithPassengersDown = [];
var floorsWithPassengersUp = [];
for (var e = 0; e < elevators.length; e++){
elevators[e].on("idle", function() {
var floorsWithPassengers = floorsWithPassengersDown.concat(floorsWithPassengersUp);
// go to a floor with passengers
if(floorsWithPassengers.length > 0){
@alber70g
alber70g / ui-validate_example.html
Created August 5, 2014 13:52
ui-validate example
<input id="itemcodeSupplier" type="text" name="artikelcodeLeverancier" placeholder="Binnen gekozen productklasse (bijv. code 1; code2)"
ng-disabled="!Filters.SelectedProductClassId" ng-model="FiltersText.SelectedItemCodeSuppliers"
ng-list=";" ui-validate="{maxLength : 'maxLengthValidator($value, 35)' }" />
<span style="color: red" ng-show="selectie.artikelcodeLeverancier.$error.maxLength">
<script>
var maxLengthValidator = function ($value, 35){
return $value.length <= 35;
}
@alber70g
alber70g / UsingStream.cs
Last active December 19, 2015 02:29
Voorbeeld van een FileStream en MemoryStream en wat de 'Dispose' method doet.
var memstream = new MemoryStream();
using (var file = new FileStream("C:/iets/iets.jpg", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
// hier gebruik je de stream, en kopieer je de file naar het geheugen (de memorystream)
file.CopyTo(memstream);
// En als je aan 't einde bent gekomen doet ie automatisch: (bij de '}')
file.Dispose();
// en in Dispose(); gebeuren een aantal dingen:
@alber70g
alber70g / view.php
Last active December 14, 2015 20:08
<?php
$modelPersoonHasStdTaak = PersoonHasStdTaak::model()->findByPk(array('idPersoon' => 5, 'idPlanning' => 5, 'idStdActiviteit' => 4, 'idStdTaak' => 7));
echo $this->widget('editable.EditableField', array(
'type' => 'select',
'model' => $modelPersoonHasStdTaak,
'attribute' => 'idPersoon0', // idPersoon0 is the attribute to show (i think). At least thats what I can see on the page
'url' => $this->createUrl('persoonhasstdtaak/updatepersoonhasstdtaak'),
'source' => CHtml::listData(Persoon::model()->findAll(), 'idPersoon', 'Naam'),
'placement' => 'right',