Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
DinisCruz / install-steps.txt
Last active May 26, 2016 17:14
GCloud Windows Setup scripts
New windows VM (note: this needs to be converted into a script)
1) installed chocolatey
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
2) installed chrome, fiddler, git, VS Code
choco install googlechrome git fiddler4 -y
@DinisCruz
DinisCruz / first-version.cs
Last active November 10, 2019 21:04
Confirming which ASP.NET controls are vulnerable to XSS via the .Text propert
public static class HtmlControls_ExtensionMethods
{
public static string renderControl(this Control control)
{
var stringBuilder = new StringBuilder();
using (var stringWriter = new StringWriter(stringBuilder))
using (var htmlTextWriter = new HtmlTextWriter(stringWriter))
control.RenderControl(htmlTextWriter);
return stringBuilder.str();
@DinisCruz
DinisCruz / 1.run-mocha-test.coffee
Last active November 23, 2015 19:31
Coderpad code samples
Mocha = require 'mocha'
expect = require('chai').expect
mocha = new Mocha {ui: 'bdd'}
mocha.suite.emit 'pre-require', this, 'solution', mocha
describe 'test', ->
it 'acb', ->
expect(12).to.equal(12)
@DinisCruz
DinisCruz / 1.directive.with.urlTemplate.coffee
Last active August 29, 2015 14:26
Testing Angular.js components
expect = chai.expect;
app = angular.module('TM_App')
app.directive "test", ()->
templateUrl:"some.html",
replace :true
describe '| testing | templateUrl',->
element = null
@DinisCruz
DinisCruz / 1.page-component
Last active August 29, 2015 14:25
XSS in Angular Directive
extends index.jade
append head
base(href='/angular/component/')
script.
angular.module('TM_App') //disable routing
.config(
function($stateProvider, $urlRouterProvider, $locationProvider)
{
$urlRouterProvider.deferIntercept();
});
function TodoCtrl( $scope )
{
$scope.todos =
[
{ text: 'learn angular', done:true },
{ text: 'build an angular app', done:false },
{ text: 'A NEW Angular TO DO', done:true }
];
$scope.addTodo = function()
@DinisCruz
DinisCruz / 1.index.jade
Created July 1, 2015 05:55
PoC of Angular, Jade and CoffeeScript (with auto compile)
extends ../../../TM_Jade/_layouts/page_logged_out.jade
block content
script(src='/angular/js/lib.js')
#application
.row
.col-3
.col-3
div(ng-controller="TestController")
@DinisCruz
DinisCruz / Angular 1.4 with Jade with coffee.jade
Created June 26, 2015 00:47
Angular 1.4 with Jade with coffee
doctype html
html(lang="en")
head
meta(charset="utf-8")
title Test
script(src='https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.js')
script(src='http://coffeescript.org/extras/coffee-script.js')
style.
input { width: 200px }
@DinisCruz
DinisCruz / Webstorm configs.txt
Last active August 29, 2015 14:23
Misc new OSX config - add colors to .bash_profile
File Watcher
CoffeeScript
```
/usr/local/bin/coffee
--output $ProjectFileDir$/.dist/$FileDirRelativeToProjectRoot$/ --compile --map $FileName$
$FileDir$
$ProjectFileDir$/.dist/$FileDirRelativeToProjectRoot$/$FileNameWithoutExtension$.js:$ProjectFileDir$/dist/$FileDirRelativeToProjectRoot$/$FileNameWithoutExtension$.map
@DinisCruz
DinisCruz / install-ELK.sh
Last active August 29, 2015 14:21
Commands to install elastic search on Vagrant
vagrant init ubuntu/trusty64
vagrant up
vagrant ssh
### inside vagrant SSH
# JDK
sudo apt-get install openjdk-7-jdk openjdk-7-jre-headless
# Elastic Search