Skip to content

Instantly share code, notes, and snippets.

View sonukapoor's full-sized avatar
🎯
Hello :)

Sonu Kapoor sonukapoor

🎯
Hello :)
View GitHub Profile
@sonukapoor
sonukapoor / gist:ba547f37b49544e101ff8381fdcebcb3
Created December 5, 2017 23:51 — forked from jmervine/gist:2079897
installing mysql on ubuntu using an aws instance
$ sudo apt-get install mysql-server mysql-client
... output omitted ...
$ sudo mysqladmin -u root -h localhost password 'password'
... output omitted ...
$ mysql -u root -p
... output omitted ...
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'your_host_name' IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
@sonukapoor
sonukapoor / gist:8639fdf43357972b2e339db76de0326a
Last active May 17, 2019 18:18
VSCode User Settings with iTerm
// user settings
{
"files.insertFinalNewline": true,
"editor.minimap.enabled": false,
"prettier.singleQuote": true,
"prettier.printWidth": 120,
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"typescript.updateImportsOnFileMove.enabled": "always",
"editor.fontSize": 14,
@sonukapoor
sonukapoor / gist:8d78f1d8b1577cb04268add8ce6cbd00
Created September 7, 2017 20:58
Creating dynamic components in angular 4
The below snippet allows us to dynamically add components into a component.
// in your component.ts
// contactContainer is a DOM element with a templateRef called #contactContainer
@ViewChild('contactContainer', { read: ViewContainerRef }) contactContainer: ViewContainerRef;
constructor(
private viewContainerRef: ViewContainerRef,
private componentFactoryResolver: ComponentFactoryResolver) {
}
@sonukapoor
sonukapoor / README.md
Created August 4, 2017 21:20 — forked from krimple/README.md
Test and class under test for Http mocking - Angular 2 beta 1

This snippet is a working example of a test against the Http service in Angular 2.0.

It is a very simple test, and provides an example of how to:

  • Provide the right wiring to the test injector
  • Inject the fake XHRBackend (i.e. MockBackend)
  • Define a potential request
  • Run the request in the framework
  • Set expectations on the result
@sonukapoor
sonukapoor / gist:6b35e88227f34e37a6df1c43a67608ee
Created July 12, 2017 20:12
Get all files in Unix without folders and push to eslintignore
find . -type f > ../.eslintignore
https://medium.com/@feloy/deploying-an-i18n-angular-app-with-angular-cli-fc788f17e358
@sonukapoor
sonukapoor / gist:16b95052703ab0dcf7db2ca41a2e6676
Last active June 28, 2017 14:20
zsh integration with vscode
Download and install the fonts from: https://github.com/powerline/fonts
Use the following user settings in VS Code:
// Place your settings in this file to overwrite the default settings
{
"terminal.external.osxExec": "iterm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Source Code Pro for Powerline"
}
@sonukapoor
sonukapoor / zsh config
Created June 28, 2017 13:50
zsh config located at ~/.zshrc using nvm, agnoster theme, git aliases
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/skapoor/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="agnoster"
@sonukapoor
sonukapoor / gist:a35055ab8553a056dca6aaf60e16fbe8
Created June 28, 2017 13:28
Set current directory in prompt of iTerm - Oh My Zsh
For the people asking about to show only the current path, do this:
- Open this directory ~/.oh-my-zsh/themes
- Open the agnoster.zsh-theme file with any text editor
- Go to the prompt_dir() function
- Replace the line in the function with this: prompt_segment blue black '%c'
- Restart iTerm or enter source ~/.zshrc
- Done. Now the theme only shows the current path.
defaults write NSGlobalDomain KeyRepeat -int 0