Skip to content

Instantly share code, notes, and snippets.

View DanyelMorales's full-sized avatar
🦆
#stayHome

Daniel V Morales DanyelMorales

🦆
#stayHome
  • Software Engineer
  • San Antonio, Texas
View GitHub Profile
@DanyelMorales
DanyelMorales / reverse.js
Created December 12, 2018 15:33
Reverse Unicode Linebreaks
// Reverse Unicode Linebreaks
block = block.replace(/\uffff/g, '\n');
@DanyelMorales
DanyelMorales / sort.js
Created December 12, 2018 15:28
sort by group ASC, name ASC, version DESC
var semver = require("semver");
var blocks = [{group:"", name:"", version:""},{group:"", name:"", version:""}]
// sort by group ASC, name ASC, version DESC
blocks.sort(function(a, b) {
var nameA = a.group + a.name;
var nameB = b.group + b.name;
if (nameA === nameB) {
if (a.version === b.version)
@DanyelMorales
DanyelMorales / detectLineEnding.js
Created December 12, 2018 15:26
Detect and return OS specific line ending.
/**
* Detect and return OS specific line ending.
*
* @returns {String}
*/
function detectLineEnding() {
if ( os.platform() === 'win32' )
return '\r\n';
if ( os.platform() === 'darwin' )
@DanyelMorales
DanyelMorales / detectLineEnding.js
Created December 12, 2018 15:26
Detect and return OS specific line ending.
/**
* Detect and return OS specific line ending.
*
* @returns {String}
*/
function detectLineEnding() {
if ( os.platform() === 'win32' )
return '\r\n';
if ( os.platform() === 'darwin' )
@DanyelMorales
DanyelMorales / clean_spaces.js
Created December 12, 2018 15:23
replace spaces for line endings
var apiData = JSON.stringify(blocks, null, 2);
apiData = apiData.replace(/(\r\n|\n|\r)/g, app.options.lineEnding);
react-native start --reset-cache
@DanyelMorales
DanyelMorales / fizzbuzz
Created September 25, 2018 17:05
fizzbuzz_elixir.exs
------------- uggly solution
if(num es multiplo de 3){
if(num es multiplo de 5){
//FizzBuzz
} else {
// Fizz
}
}else if(multiplo de 5){
// buzz
@DanyelMorales
DanyelMorales / git-tag-delete-local-and-remote.sh
Created September 25, 2018 15:14 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@DanyelMorales
DanyelMorales / AbstractTestCommon.java
Last active August 22, 2018 15:57
JAVA DROPWIZARD 0.7 example for common test utils
package anyp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import java.util.Set;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@DanyelMorales
DanyelMorales / Helloworld.txt
Created August 15, 2018 19:43
Helloworld.txt
<h1>Hello world, foobar,</h1>
<h2>test</h2>
dvera@sunset.com dvera@sunset.com
http://hello.com
http://hello-aaaa.com