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 / 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 / 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
@DanyelMorales
DanyelMorales / hook.sh
Created July 16, 2018 20:56
Observe a file and then execute a command
#!/usr/bin/env bash
# usage: hook.sh ./**/*.ext "echo 'hello world when this file changes'"
inotify-hookable -f $1 -c "$2"
@DanyelMorales
DanyelMorales / Gruntfile.js
Created June 25, 2018 17:14
Precompile scss to css
var root = "./assets";
var publicPath = "./public/assets";
var cssPath = publicPath + "/css/";
var jsPath = publicPath + "/js/";
var htmlDevelopmentFiles = ['./app/views/**/*.html'];
var sass = {
source: root + '/css/',
dest: cssPath,
pattern: "**/*.scss"