Skip to content

Instantly share code, notes, and snippets.

@dhamaso
dhamaso / Add_Existing_Project_To_Git.md
Created October 19, 2020 14:31 — forked from alexpchin/Add_Existing_Project_To_Git.md
Add Existing Project To Git Repo

#Adding an existing project to GitHub using the command line

Simple steps to add existing project to Github.

1. Create a new repository on GitHub.

In Terminal, change the current working directory to your local project.

##2. Initialize the local directory as a Git repository.

git init
@dhamaso
dhamaso / renaming.markdown
Created September 17, 2020 01:59 — forked from n3dst4/renaming.markdown
How to rename Visual Studio solutions and projects

How to rename solutions and projects in Visual Studio

  1. Don't.

How to rename solutions and projects that were created in Visual Studio

  1. Close Visual Studio and don't open it again until I tell you. Visual Studio is not competent at renaming things.
  2. Assuming you're using git, clean the working folder to remove anything that's not in version control (this will help the search-and-replace step because it won't have to go through a bunch of generated files)

git clean -fdx

@dhamaso
dhamaso / handlebars-helper-x.js
Created June 15, 2020 15:19 — forked from akhoury/handlebars-helper-x.js
Handlebars random JavaScript expression execution, with an IF helper with whatever logical operands and whatever arguments, and few more goodies.
// for detailed comments and demo, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " name == 'Sam' && age === '12' " }}
BOOM
@dhamaso
dhamaso / EntityBase.cs
Created June 12, 2019 16:36 — forked from saurabhpati/EntityBase.cs
Stored procedure - EF Core
/// <summary>
/// Using this class for base will default the primary key of the entity to be int.
/// </summary>
public class EntityBase : EntityBase<int>
{
}
/// <summary>
/// The base entity.
/// </summary>
@dhamaso
dhamaso / reset input file jquery
Created October 2, 2017 17:43
Reset input file jquery
// https://www.gyrocode.com/articles/how-to-reset-file-input-with-javascript/
var $el = $('#example-file');
$el.wrap('<form>').closest('form').get(0).reset();
$el.unwrap();
@dhamaso
dhamaso / SQL SHORT WHERE IF
Created October 6, 2015 17:14
Forma un condición en base a si existe un parametro o no.
@paramName IS NULL OR columnName = @paramName
@dhamaso
dhamaso / Xml javascript escape
Created September 24, 2015 20:32
Escapar caracteres especiales xml con javascript
function htmlSpecialChars(unsafe) {
return unsafe
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/'/g, "&apos;")
.replace(/"/g, "&quot;");
}
@dhamaso
dhamaso / Media Query CSS
Created January 31, 2014 19:01
Media Query CSS Template
/*=====================================================
Twitter Bootstrap
=====================================================*/
/* Large desktop */
@media (min-width: 1200px) { ... }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }
/* Landscape phone to portrait tablet */
@dhamaso
dhamaso / permisos solo a carpetas
Created January 18, 2014 03:45
Aplicar permisos recursivos solo para carpetas
find /path/to/base/dir -type d -exec chmod 755 {} +