Skip to content

Instantly share code, notes, and snippets.

View hansfpc's full-sized avatar
🌗
There ain't no such thing as a free lunch.

Hans Piña hansfpc

🌗
There ain't no such thing as a free lunch.
View GitHub Profile
@bnoguchi
bnoguchi / enum-access.js
Created May 3, 2011 09:19
How to access enumValues in mongoose from a Model or Document
var mongoose = require('./index')
, TempSchema = new mongoose.Schema({
salutation: {type: String, enum: ['Mr.', 'Mrs.', 'Ms.']}
});
var Temp = mongoose.model('Temp', TempSchema);
console.log(Temp.schema.path('salutation').enumValues);
var temp = new Temp();
console.log(temp.schema.path('salutation').enumValues);
@ralphcrisostomo
ralphcrisostomo / array_dupplicate_counter.js
Created July 19, 2012 07:43
Javascript: Count duplicates in an array
/**
Problem:
You have a javascript array that likely has some duplicate values and you would like a count of those values.
Solution:
Try this schnippet out.
*/
@AvnerCohen
AvnerCohen / npm-cheat-sheet.md
Last active August 18, 2024 08:34
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

List of less common (however useful) NPM commands

Prepand ./bin to your $PATH

Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@jbail
jbail / local-storage-with-json-parse-stringify.js
Created December 23, 2012 18:08
Local storage with JSON parse and stringify
var animal = {
name: 'Karl',
type: 'cat',
color: 'black',
age: 7
};
//convert JSON animal into a string
var dehydratedAnimal = JSON.stringify(animal);
@rxaviers
rxaviers / gist:7360908
Last active November 15, 2024 16:55
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 14, 2024 15:40
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@ntarocco
ntarocco / nico.zsh-theme
Last active October 23, 2017 16:57
Yet another ZSH theme, simple and nice looking
# fork from AVIT ZSH Theme
PROMPT='
$(_user_host)${_current_dir}$(git_prompt_info)
$ '
PROMPT2='%{$fg[grey]%}◀%{$reset_color%} '
#RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(git_prompt_short_sha) $(_git_time_since_commit) ${_return_status} %T% %{$(echotc DO 1)%}'
RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(git_prompt_short_sha) ${_return_status} %T% %{$(echotc DO 1)%}'
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active November 5, 2024 15:51
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@vesse
vesse / express-jwt.js
Last active October 3, 2024 10:52
Two Passport + JWT (JSON Web Token) examples
//
// Implementation using express-jwt middle
//
var express = require('express'),
ejwt = require('express-jwt'),
jwt = require('jsonwebtoken'),
passport = require('passport'),
bodyParser = require('body-parser'),
LocalStrategy = require('passport-local').Strategy,
BearerStrategy = require('passport-http-bearer').Strategy;
@carlessanagustin
carlessanagustin / Nginx_Cheat_Sheet.md
Last active November 9, 2024 06:00
Nginx Cheat Sheet