Skip to content

Instantly share code, notes, and snippets.

create-react-app appname
cd addname
yarn add --dev concurrently wait-on electron
yarn add electron-is-dev

package.json

{
  "name": "my-electron-app",
@mairh
mairh / Redux-Form-Semantic-UI-React
Last active August 12, 2021 23:03
Semantic-UI-React form validation using redux-form example
// semantic-ui-form.js
import React from 'react';
import PropTypes from 'prop-types';
import { Form, Input } from 'semantic-ui-react';
export default function semanticFormField ({ input, type, label, placeholder, meta: { touched, error, warning }, as: As = Input, ...props }) {
function handleChange (e, { value }) {
return input.onChange(value);
}

Tape vs Mocha

What is Mocha? Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser.

What is Tape? Tape is a tap-producing test harness for node and browsers

Comparision

Features

Feature Tape Mocha
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@iffy
iffy / .gitignore
Last active January 7, 2026 20:59
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@fgilio
fgilio / axios-catch-error.js
Last active February 11, 2026 16:18
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@luckydev
luckydev / gist:b2a6ebe793aeacf50ff15331fb3b519d
Last active June 7, 2026 21:58
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@joelpalmer
joelpalmer / adapter.ts
Created February 28, 2017 15:39
Adapter Pattern with TypeScript
//target (our payment object interface)
interface IPayment {
id: string;
total: number;
SubmitPayment: Function;
}
//our payment class
class Payment implements IPayment {
public id: string;
public total: number;
@alepez
alepez / android-mosquitto-cmake.sh
Created February 22, 2017 00:37
Build mosquitto for android
cmake -DANDROID_NDK=/opt/android-ndk/android-ndk-r10e -DANDROID_ABI="armeabi" -DANDROID_NDK_HOST_X64="YES" -DANDROID_TOOLCHAIN_NAME="arm-linux-androideabi-4.9" -DCMAKE_TOOLCHAIN_FILE="/opt/android-ndk/build/cmake/android.toolchain.cmake" -DWITH_TLS=OFF -DWITH_THREADING=OFF ..
@pierreprinetti
pierreprinetti / InstallingTmuxOnCentOS.md
Last active September 4, 2019 07:24 — forked from rkaneko/InstallingTmuxOnCentOS.md
Installing tmux 2.3 on CentOS 7

Installing tmux 2.3 on CentOS

Prerequites

  • libevent libevent-devel libevent-headers
  • curl
# remove old pkgs