Skip to content

Instantly share code, notes, and snippets.

@sudheerDev
sudheerDev / SassMeister-input.scss
Created October 22, 2014 09:52
Generated by SassMeister.com.
// ----
// Sass (v3.4.6)
// Compass (v1.0.1)
// ----
@function media-querie($screen,$range) {
$range-value: map-has-key($screen-list, $screen);
@sudheerDev
sudheerDev / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sudheerDev
sudheerDev / destructuring.js
Created March 7, 2017 11:22 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
function callAjax(url, callback){
var xmlhttp;
// compatible with IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
callback(xmlhttp.responseText);
}
}
xmlhttp.open("GET", url, true);
var opts = {
method: 'GET',
body: 'json',
headers: {}
};
fetch('/get-data', opts).then(function (response) {
return response.json();
})
.then(function (body) {
//doSomething with body;
@sudheerDev
sudheerDev / createStore.js
Created August 10, 2017 04:59
bare bones of redux createStore.js
import isPlainObject from 'lodash/isPlainObject'
import $$observable from 'symbol-observable'
export var ActionTypes = {
INIT: '@@redux/INIT'
}
export default function createStore(reducer, preloadedState, enhancer) {
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
enhancer = preloadedState
@sudheerDev
sudheerDev / dynamicLoadReducers.js
Last active September 5, 2023 03:22
replaceReducer example
// This part of code is copied from Dan Abramov answer - https://stackoverflow.com/a/33044701/2902013
import { combineReducers } from 'redux';
import { createStore } from 'redux';
//couple of reducers available as part of inital config of app.
import users from './reducers/users';
import posts from './reducers/posts';
function createReducer(asyncReducers) {
{
"ServiceSettings": {
"SiteURL": "http://localhost:8065",
"LicenseFileLocation": "",
"ListenAddress": ":8065",
"ConnectionSecurity": "",
"TLSCertFile": "",
"TLSKeyFile": "",
"UseLetsEncrypt": false,
"LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache",
````
{
"data": {
"AboutLink": "https://about.mattermost.com/default-about/",
"AllowEditPost": "always",
"AndroidAppDownloadLink": "https://about.mattermost.com/mattermost-android-app/",
"AndroidLatestVersion": "",
"AndroidMinVersion": "",
"AppDownloadLink": "https://about.mattermost.com/downloads/",
"AvailableLocales": "",
{"level":"debug","ts":1531823529.7227802,"caller":"web/handlers.go:50","msg":"GET - /api/v4/channels/4tqx1ha5qbfj5mqhnqsxqawj7e/posts/unread"}
{"level":"error","ts":1531823529.7244754,"caller":"app/server.go:60","msg":"Please check the std error output for the stack trace"}
{"level":"error","ts":1531823529.7298934,"caller":"app/server.go:61","msg":"[runtime error: invalid memory address or nil pointer dereference]"}
goroutine 2220 [running]:
runtime/debug.Stack(0x0, 0x0, 0x1c6d960)
/usr/local/Cellar/go/1.10.2/libexec/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
/usr/local/Cellar/go/1.10.2/libexec/src/runtime/debug/stack.go:16 +0x22
github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers.recoveryHandler.log(0x2026060, 0xc421d1c140, 0x2026080, 0x28279d8, 0x1, 0xc4212b46f0, 0x1, 0x1)
/Users/sudheer.t/go/src/github.com/mattermost/mattermost-server/vendor/github.com/gorilla/handlers/recovery.go:89 +0x70