Skip to content

Instantly share code, notes, and snippets.

@sdwio
sdwio / all-angular-material-components-imports.txt
Created August 24, 2019 13:04 — forked from pimatco/all-angular-material-components-imports.txt
All Angular Material Components Imports from app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
//Angular Material Components
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatCheckboxModule} from '@angular/material';
import {MatButtonModule} from '@angular/material';
@sdwio
sdwio / label.css
Created September 22, 2017 08:45
fading label
input:placeholder-shown + label, textarea:placeholder-shown + label {
opacity:0;
transition: opacity 0.33s;
}
input + label {
transition: opacity 0.33s;
opacity:1;
}
@sdwio
sdwio / gist:cce8ff50d9988eedf331b83a3dac0b2d
Last active September 15, 2017 08:03
JetBrains scss filewatcher
Careful here SCSS-type watchers ignore partial files i.e. files starting with _ like _foo.scss
the enviroment variable
`COMPILE_PARTIAL=true`
is required to handle partial files over the watcher e.g. for prettier or linting
@sdwio
sdwio / .htaccess
Created September 15, 2017 07:30
React routing .htacces
RewriteEngine On
# allow direct access on folders and files
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
# @see https://stackoverflow.com/questions/17302644
RewriteRule ^ - [L]
# send all other calls directly ro index.html
# and leave the further routing to the app
RewriteRule ^ /index.html [L]
@sdwio
sdwio / package.json
Created September 15, 2017 06:17
nodemon flow && flow-coverage-report
{
"scripts": {
"flow": "clear && flow && flow-coverage-report -i 'src/**/*.js' -i 'src/**/*.jsx' -x 'src/test/**' -t html -t json -t text || true",
"watch-flow": "nodemon --exec \"npm run flow\" --ext js,jsx --watch tst --watch src",
}
}
@sdwio
sdwio / .jsx
Created August 14, 2017 05:51
[React] generalizable handle input function
function handleInputChange(event) {
const { target } = event;
if (target instanceof HTMLInputElement) {
const value = target.type === "checkbox" ? target.checked : target.value;
const name = target.name;
this.setState({
[name]: value
});
} else {
console.error("Argument obtained:");
@sdwio
sdwio / CMakeLists.txt
Created June 15, 2017 07:54
very basic CMakeLists file
cmake_minimum_required( VERSION 3.5.1 )
project( someProjectName )
include_directories(
include
/usr/local/boost_1_62_0
)
## File(GLOB...) allows for wildcard additions:
file( GLOB_RECURSE SOURCES
@sdwio
sdwio / global-gitignore.md
Last active May 30, 2017 18:51 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. they may be ignored system-wide.

Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
@sdwio
sdwio / package.json
Created April 11, 2017 15:02
silencing npm error messages
{
"explanation": "if the exit code is other than 0 the true gets returned thus silencing the npm error"
"scripts": {
"f": "clear && flow || true",
"fw": "./node_modules/.bin/nodemon --exec \"npm run f\" --ext js,jsx --watch tst --watch src"
}
}
@sdwio
sdwio / gist:2a3ce612a73fab652af6cf5646ffbcc0
Last active February 20, 2017 07:07
nginx basic proxy block
http {
#adding ssl
server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
root /var/www;
location / {