Skip to content

Instantly share code, notes, and snippets.

View brunolm's full-sized avatar
🏠
Working from home

BrunoLM brunolm

🏠
Working from home
View GitHub Profile
@brunolm
brunolm / example.js
Created April 3, 2011 00:33
Uri object similar to .NET Uri
var www = new Uri("http://www.stackoverflow.com:80/path/sub.aspx?query=11#!/path2?query2=2");
var t = [];
for (var i in www)
{
t.push(i + " " + www[i]);
}
alert(t.join("\n"));
@brunolm
brunolm / UnitTest.ts
Created July 18, 2013 18:53
Class to do Unit Test with TypeScript and TSTestAdapter
class Assert
{
public static AreEqual<T>(expected: T, actual: T, message: string = ""): void
{
if (expected !== actual)
{
throw "Assert.AreEqual failed. "
+ "Expected: <" + expected + ">. "
+ "Actual: <" + actual + ">. "
+ message;
curl -L "https://go.microsoft.com/fwlink/?LinkID=760868" > /tmp/vscode.deb
sudo dpkg -i /tmp/vscode.deb && sudo apt-get install -f
@brunolm
brunolm / script.js
Last active February 15, 2018 14:33
Export wordpress posts to bash echos in jekyll format
// first inject jQuery on the page, then run on /wp-admin/edit.php
// wait for it then run o.join('\n')
// execute the output on _posts folder
var o = [];
(function() {
let posts = [].slice.call(document.querySelectorAll('.post_name')).map(e => {
let container = e.parentNode;
let id = container.id.split('_')[1];
let editUrl = `https://your.wordpress.com/wp-admin/post.php?post=${id}&action=edit`;
@brunolm
brunolm / README.md
Created June 24, 2016 17:00
Visual Studio Code Extensions
@brunolm
brunolm / update-sqlectron.sh
Created December 14, 2016 19:30
Update SQLEctron
update-sqlectron() {
local x=$(curl -s https://github.com/sqlectron/sqlectron-gui/releases | grep '/sqlectron/sqlectron-gui/releases/tag/' | head -n 1 | awk -F "[><]" '{print $3}' | head -n 2 | sed 's,v,,g')
curl -L "https://github.com/sqlectron/sqlectron-gui/releases/download/v$x/Sqlectron-$x.deb" > /tmp/sqlectron.deb
sudo dpkg -i /tmp/sqlectron.deb && sudo apt install -f
}
@brunolm
brunolm / VSDark.StorableColorTheme.ps1xml
Created April 26, 2017 00:05
Powershell ISE VS Dark Theme
<?xml version="1.0" encoding="utf-16"?>
<StorableColorTheme xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Keys>
<string>ErrorForegroundColor</string>
<string>ErrorBackgroundColor</string>
<string>WarningForegroundColor</string>
<string>WarningBackgroundColor</string>
<string>VerboseForegroundColor</string>
<string>VerboseBackgroundColor</string>
<string>DebugForegroundColor</string>
@brunolm
brunolm / styles.css
Created July 17, 2017 22:21
Angular validation CSS Styles
.ng-invalid.ng-touched:not(:focus):not(form) { border: 1px solid red; }
.ng-untouched ~ span, :focus ~ span { display: none; }
.ng-valid ~ span { display: none; }
@brunolm
brunolm / validation-messages.md
Created July 23, 2017 20:42
UX - Field validation messages (en / pt-br)

Validation messages for form inputs

en

The {field} field is required.
The {field} field must contain a valid email address.
The {field} field must contain all valid email addresses.
The {field} field must contain a valid URL.
The {field} field must contain a valid IP.