Skip to content

Instantly share code, notes, and snippets.

View sajadghawami's full-sized avatar
⌨️

Sajad Ghawami sajadghawami

⌨️
View GitHub Profile
@iamtmrobinson
iamtmrobinson / custom-props.tsx
Created January 8, 2018 14:49
Using custom props with a Redux form in Typescript
import * as React from 'react';
import {
Field as FormField,
InjectedFormProps,
reduxForm,
} from 'redux-form';
interface CustomProps {
customText: string;
}
@roboticboyer
roboticboyer / MQTT_test.ino
Last active November 5, 2017 17:23
MQTT_test
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
// Update these with values suitable for your network.
//const char *ssid = "localwifi";
//const char *password = "localpassword";
const char *ssid = "MyAP";
node_modules
@CatTail
CatTail / client.html
Created February 9, 2017 10:17
Simple Req/Rep pattern for socket.io (which is Pub/Sub in nature)
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.2/socket.io.js"></script>
<script>
var socket = io('http://localhost:8088');
var route = createRouter((reply) => {
socket.on('rep', reply)
})
socket.emit('req', route('hello world', (data) => {
console.log(data)
}))
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active October 10, 2023 15:31
amazon ec2 LAMP and FTP installation and setup
@adnan-i
adnan-i / mongoose-aggregate-by-month-year.js
Last active October 22, 2020 15:30
Mongoose aggregation for grouping users by month/year subscribed
User.aggregate([
{
/* Filter out users who have not yet subscribed */
$match: {
/* "joined" is an ISODate field */
'subscription.joined': {$ne: null}
}
},
{
/* group by year and month of the subscription event */
@staltz
staltz / introrx.md
Last active May 20, 2024 14:59
The introduction to Reactive Programming you've been missing
@langhard
langhard / model-user.js
Last active September 2, 2020 20:03
Node.js, Passport, SequelizeJS, LocalStrategy, crypto (md5)
/** *********************************************************
* API - Model - User
********************************************************* */
module.exports = function (sequelize, DataTypes) {
return sequelize.define('User', {
username: DataTypes.STRING,
password: DataTypes.STRING,
firstName: DataTypes.STRING,
lastName: DataTypes.STRING,
@tommcfarlin
tommcfarlin / add-custom-post-type-menu.php
Created April 25, 2013 12:38
[WordPress] Add a custom post type menu as a child of an existing custom post type menu.
<?php
// Define the 'Portfolio' post type. This is used to represent galleries
// of photos. This will be our top-level custom post type menu
$args = array(
'labels' => array(
'all_items' => 'Gallery',
'menu_name' => 'Portfolio',
'singular_name' => 'Gallery',
'edit_item' => 'Edit Gallery',