Skip to content

Instantly share code, notes, and snippets.

/*
Error: Invalid CSS after "#": expected id name, was "!/usr/bin/env node"
on line 1 of bin/sass-args.js
1: #!/usr/bin/env node
2:
3: const path = require('path')
4: const tsConfig = require(path.resolve(__dirname, '../tsconfig.json'))
5:
6: let packagePaths = tsConfig.compilerOptions.paths
@mohas
mohas / PaginationACtions.js
Last active April 25, 2021 11:24
ra-ui-material PaginationActions with theming.direction RTL support
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import pure from 'recompose/pure';
import Button from '@material-ui/core/Button';
- import { withStyles, createStyles } from '@material-ui/core/styles';
+ import { withStyles, createStyles, withTheme } from '@material-ui/core/styles';
import ChevronLeft from '@material-ui/icons/ChevronLeft';
import ChevronRight from '@material-ui/icons/ChevronRight';
import compose from 'recompose/compose';
import { translate } from 'ra-core';
@mohas
mohas / leaflet.html
Created May 15, 2020 15:25
quick leaflet Setup
<div class="row">
<div id="to_hell_with_g_map" style="width: 100%; height: 500px"></div>
</div>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js" integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" crossorigin=""></script>
<script type="text/javascript">
var lat = 35.70603;
var lon = 51.43588;
//you can use this script with browser extensions like cjs or script monkey
//you have to inject jQuery
$('.score').each((_,el)=>{
const points = Number($(el).text().replace(' points', ''))
if(points < 100)
return
$(el).parent().parent().prev().css({backgroundColor:'#efd52363'})
})
@mohas
mohas / nwb.config.js
Created February 13, 2022 10:17
using @emotion/react css property with nwb
module.exports = function () {
return {
type: 'react-component',
npm: {
esModules: true,
umd: false
},
babel: {
presets: ['@emotion/babel-preset-css-prop'],
}
@mohas
mohas / index.html
Created February 16, 2022 14:06
Validate html file input with image width and height, uses jquery
<form class="form-horizontal" validate-files method="post" action="/pics" enctype="multipart/form-data">
<div class="form-group">
<label class="col-sm-4">file 1</label>
<div class="col-sm-7">
<input type="file" class="form-control" name="pic1" accept=".jpg" accept-width="300" accept-height="350" />
<div class="helper-block">jpg and 300x350</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4">file 2</label>
@mohas
mohas / index.js
Created February 21, 2022 23:38
zeromq node.js example with router and multiple req sockets, CURVE authentication and identity
//most of the code on the internet is for version 5 so here is a workign sample
//hope it helps somebody
// Demonstrate request-reply identities
var zmq = require('zeromq')
var helper = require('./zhelpers')
const serverkey = zmq.curveKeyPair()
const clientkey = zmq.curveKeyPair()
const addr = "tcp://127.0.0.1:12345"//CURVE don't work for inproc schema