Skip to content

Instantly share code, notes, and snippets.

View luis-fss's full-sized avatar
:octocat:
Hey

Luis Fernando de Souza Santos luis-fss

:octocat:
Hey
View GitHub Profile
@luis-fss
luis-fss / NugetCommandLineTips.txt
Created November 18, 2015 23:49
Nuget command line tips
Nuget command line – uninstall package from all projects
> Get-Project -All | Uninstall-Package <package name>
@rponte
rponte / get-latest-tag-on-git.sh
Last active December 9, 2024 00:27
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@victor-rds
victor-rds / brdocs.cpfcnpjValidator.js
Last active July 11, 2024 19:13
Extensão para JQuery Validation Plugin (jqueryvalidation.org) que valida o número de CPF ou CNPJ (inclusive os dois ao mesmo tempo num único campo), usa "namespace" brdocs para evitar conflitos, a função calculaDigito() pode ser usada sozinha caso você deseje mudar a lógica do validador ou criar seu método de validação em outro framework ou plugin.
brdocs = {
/**
* Enum com opções do validador
* @readonly
* @enum {number}
*/
cpfcnpj: { "CPF": 1, "CNPJ": 2, "AMBOS": 3 },
/**
* Função que valida CPF e CNPJ de uma só vez.
@Jelby-John
Jelby-John / glyphicons.files.css
Last active December 22, 2017 15:02
Glyphicons Pro in Twitter Bootstrap 3
@font-face { font-family: 'Glyphicons files'; src: url('../fonts/glyphicons-filetypes-regular.eot'); src: url('../fonts/glyphicons-filetypes-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-filetypes-regular.woff') format('woff'), url('../fonts/glyphicons-filetypes-regular.ttf') format('truetype'), url('../fonts/glyphicons-filetypes-regular.svg#glyphicons-filetypes-regular') format('svg'); } .glyphfiles { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons files'; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }.glyphfiles-txt:before {content: "\e001"; }.glyphfiles-doc:before {content: "\e002"; }.glyphfiles-rtf:before {content: "\e003"; }.glyphfiles-log:before {content: "\e004"; }.glyphfiles-tex:before {content: "\e005"; }.glyphfiles-msg:before {content: "\e006"; }.glyphfiles-text:before {content: "\e007"; }.glyphfiles-wpd:before {content: "\e008"; }.glyphfiles-wps:before {con
@JulianRooze
JulianRooze / Expressions.cs
Created November 26, 2012 17:12
Build expressions
class Employee
{
public IList<Order> Orders { get; set; }
}
class Order
{
public int OrderID { get; set; }
public IList<Customer> Customers { get; set; }
@NOtherDev
NOtherDev / ControllerActionInvokerWithDefaultJsonResult.cs
Created September 22, 2012 17:26
ASP.NET MVC: Replacing the default ActionInvoker to do something useful with non-ActionResult return types
// ASP.NET MVC: Replacing the default ActionInvoker to do something useful with non-ActionResult return types
// See more: http://notherdev.blogspot.com/2012/09/non-actionresult-return-type-aspnet-mvc.html
public class MyControllerFactory : DefaultControllerFactory
{
public override IController CreateController(RequestContext context, string controllerName)
{
var controller = base.CreateController(context, controllerName);
return ReplaceActionInvoker(controller);
}
@liammclennan
liammclennan / blog_connascence_methods.md
Created July 5, 2012 22:36
Named Method Arguments: From connascence of position to connascence of name

From wikipedia:

Two software components are connascent if a change in one would require the other to be modified in order to maintain the overall correctness of the system.

Connascence is a useful tool for discussing different types of coupling that occur within software.

Again from wikipedia, "connascence of name is when multiple components must agree on the name of an entity". Connascence of name one is of the list harmful and most unavoidable types of connascence because it is simple to reason about and change. While connascence of name is still connascence, and therefore bad, it is among the most amenable to refactoring. If the name of something changes then everything that refers to that thing by name must also change. This is a simple change that can be mostly statically determined and applied by tools.

Connascence of position is present when changing the order of something necessitates a change elsewhere. An example is the order of function arguments. If the order of a function's arguments is

@jonnii
jonnii / default.ps1
Created May 7, 2012 14:41
Creating a click once package using mage and powershell
task PrepareClickOnce {
write-host 'Add mage to our path'
$env:path += ";C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools"
write-host "Preparing install directory"
$installersRoot = '..\installers\app'
if (test-path $installersRoot) {
Write-Host "Cleaning installers root"
rm -r -force $installersRoot > $null
@phillip-haydon
phillip-haydon / Blobbed.cs
Created February 28, 2012 23:35
NHibernate Custom User Type for serializing a property to JSON
[Serializable]
public class Blobbed<T> : IUserType where T : class
{
public new bool Equals(object x, object y)
{
if (x == null && y == null)
return true;
if (x == null || y == null)
return false;
@philipmat
philipmat / json_entity_converter.cs
Created February 20, 2012 10:17
JSON Entity Converter
void Main()
{
var co = new Company { Id = 1, Name = "Moof Inc." };
var clarus = new Contact { Id = 1, Name = "Clarus" };
var mark = new Contact { Id = 2, Name = "Mark" };
co.AddContact(clarus);
co.AddContact(mark);
co.MainContact = clarus;
// Attempt #1: Straight up, no converter