Skip to content

Instantly share code, notes, and snippets.

View danieldelcore's full-sized avatar
🐙
Say hello!

Daniel Del Core danieldelcore

🐙
Say hello!
View GitHub Profile
@danieldelcore
danieldelcore / 01-directory-structure.md
Created December 20, 2017 23:15 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
# oh-my-zsh Theme
# Default robbyrussell theme with node version info.
# Installation: place this file in .oh-my-zsh/custom/themes/robbyrussell.zsh_theme
function node_prompt_version {
if which node &> /dev/null; then
echo "%{$fg_bold[blue]%}node(%{$fg[red]%}$(node -v)%{$fg[blue]%}) %{$reset_color%}"
fi
}
# View the log to find the commit you want to edit:
git log
# Quit out of the log
q
# Rebase from the commit you want to edit, in interactive mode:
git rebase SOME_COMMIT_ID^ --interactive
# This will open an interactive menu in Vi
'atom-workspace atom-text-editor:not([mini])':
'alt-down': 'editor:add-selection-below'
'alt-up': 'editor:add-selection-above'
'body':
'ctrl-tab ^ctrl': 'unset!'
'ctrl-tab': 'pane:show-next-item'
'ctrl-shift-tab ^ctrl': 'unset!'
'ctrl-shift-tab': 'pane:show-previous-item'
'ctrl-shift-cmd-left': 'window:focus-pane-on-left'
@danieldelcore
danieldelcore / stringUtils.js
Created July 4, 2016 04:39 — forked from cvergne/stringUtils.js
Little javascript method to get initials from a name
String.prototype.getInitials = function(glue){
if (typeof glue == "undefined") {
var glue = true;
}
var initials = this.replace(/[^a-zA-Z- ]/g, "").match(/\b\w/g);
if (glue) {
return initials.join('');
}
@danieldelcore
danieldelcore / handlebars-block-helpers.js
Created January 6, 2016 06:15
Handlebars block helpers
module.exports = {
/**
* Capitalises the string supplied
* =====================================
*/
capitals: function(str) {
return str.toUpperCase();
},
ul li:nth-child(3n) {
// Styling for every third element here.
}
@danieldelcore
danieldelcore / super-sub-script-fix.css
Created August 6, 2015 06:27
Prevent super and sub scripts from affecting the line-height
sup, sub {
vertical-align: baseline;
position: relative;
top: -0.4em;
}
sub {
top: 0.4em;
}
function getFormatedDate() {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1;
if(dd < 10) { dd = '0' + dd; }
if(mm < 10) { mm = '0' + mm; }
return dd+'/'+mm+'/' + today.getFullYear();
'use strict';
var $ = require('jquery');
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name]) {
if (!o[this.name].push) {