“No problem can be solved from the same level of consciousness that created it.” Albert Einstein (1879-1955)
Sunday, 28 July 2019
Thursday, 4 July 2019
SQL Check Query Return Results
DECLARE @query nvarchar(MAX);
SET query = N'SELECT * FROM Table WHERE id=_id'
EXEC sp_executesql @queryToPass
IF ( @@ROWCOUNT > 0)
BEGIN
-- action
END
React Alert Popup (SweetAlert)
NPM: npm install sweetalert --save
CDN: <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
import swal from 'sweetalert';
const handleSignout = (e) => {
e.preventDefault();
swal({
title: '',
text: '',
icon: '',
dangerMode: true,
buttons: {
cancel: 'Cancel',
ok: 'OK'
}
}).then((result) => {
if (result) {
// actions
}
});
};
reference: https://github.com/t4t5/sweetalert
Tuesday, 2 July 2019
Prevents React App from Flash During Firebase/API Calls
const store = createStore(
rootReducer,
compose(
applyMiddleware(
thunk.withExtraArgument({
getFirestore,
getFirebase
})
),
reduxFirestore(fbConfig),
reactReduxFirebase(fbConfig, { attachAuthIsReady: true }),
window.__REDUX_DEVTOOLS_EXTENSION__
&& window.__REDUX_DEVTOOLS_EXTENSION__()
)
);
store.firebaseAuthIsReady.then(() => {
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
});
Monday, 1 July 2019
React Routing
<BrowserRouter>
<Route exact path='/' component={LandingPage} />
<Route
path='/(.+)'
render={() => (
<div className='App'>
<Navbar />
<Switch>
<Route path='/route1' component={Component1} />
<Route path='/route2' component={Component2} />
<Route path='/route3' component={Component3} />
</Switch>
</div>
)}
/>
</BrowserRouter>
Subscribe to:
Posts (Atom)
SQL: Generate a range of numbers
SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n FROM (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n), (VALU...
-
//convert BASE64 string to Byte{} array function base64ToArrayBuffer(base64) { var binaryString = window.atob(base64); var binar...
-
static void Main(string[] args) { // create a dummy list List<string> data = GetTheListOfData(); // split the lis...
-
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter(); htmlToPdf.PageFooterHtml = @"<div style='text-align:right; font-s...