Skip to content

Instantly share code, notes, and snippets.

View davecarter's full-sized avatar
:octocat:
coding like there is no tomorrow

David Garcia davecarter

:octocat:
coding like there is no tomorrow
View GitHub Profile
@arielweinberger
arielweinberger / strong-password-regex.md
Last active September 8, 2024 06:47
Strong password Regular Expression - NestJS Course
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
sudo curl -o /usr/local/bin/imgcat -O https://raw.githubusercontent.com/gnachman/iTerm2/master/tests/imgcat && sudo chmod +x /usr/local/bin/imgcat
# If you have a better way to fix the permissions, comment below!

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () => x) {
@carlosvillu
carlosvillu / src.js
Created July 15, 2015 10:59
Solución al workshop de ES6
// Number -> Number -> Number
export const add = (a, b) => a + b
export const sum = (...numbers) => numbers.reduce(add, 0)
// Number -> Number
export const square = (x) => x * x
// Number -> Void
export const asyncSquare = (coll) => () => coll.map(square)
@nucliweb
nucliweb / gist:f984b9fc75a1c82ef1a1
Last active June 29, 2022 09:26
Sublime Text 3 on OS X Terminal

Sublime Text 3 on OS X Terminal

By creating link

Linking into /usr/bin with sudo:

$ sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/sbl
@max-mykhailenko
max-mykhailenko / # Sublime Emmet JSX Reactjs.md
Last active November 25, 2022 23:25
Sublime text 3. Enable Emmet in JSX files with Sublime React plugin

This is no longer needed as Emmet supports JSX - you just need to turn it all on. Did a quick tutorial: http://wesbos.com/emmet-react-jsx-sublime/

Thanks, @wesbos

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed
@briansorahan
briansorahan / mkcd
Created October 1, 2013 15:08
bash alias for a 'mkcd' command which creates a dir and cd's into it
mkcd() { mkdir -p "$@" && cd "$@"; }
@toddmotto
toddmotto / gist:6596373
Created September 17, 2013 15:56
Disable Web Security in Chrome Canary to make cross-domain XHR requests (local servers obvs).
open -a Google\ Chrome\ Canary --args --disable-web-security
@ericelliott
ericelliott / flyweight-factory-module.js
Last active November 6, 2015 21:38
Flyweight Factory Module Pattern
var myPrototype = {
methodA: function methodA() {},
methodB: function methodB() {},
methodC: function methodC() {}
};
createFoo = function createFoo() {
return (Object.create(myPrototype));
};