Skip to content

Instantly share code, notes, and snippets.

View MohammadMD1383's full-sized avatar
💭
I may be slow to respond.

Mohammad Mostafa Dastjerdi MohammadMD1383

💭
I may be slow to respond.
View GitHub Profile
@MohammadMD1383
MohammadMD1383 / Modal.js
Last active December 14, 2020 11:25
use this module to create your bootstrap modals easily with javascript.
export default class Modal {
/** @type {boolean} */
static #isModalOpen = false;
/** @type {boolean} */
static #isRtl = false;
/** @param {boolean} bool */
static set isRtl(bool) {
@jstnlvns
jstnlvns / git: gitignore.md
Created November 16, 2018 19:42
a gitignore cheatsheet

Git sees every file in your working copy as one of three things:

  1. tracked - a file which has been previously staged or committed;
  2. untracked - a file which has not been staged or committed; or
  3. ignored - a file which Git has been explicitly told to ignore.

Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be committed. Some common examples are:

  • dependency caches, such as the contents of /node_modules or /packages
  • compiled code, such as .o, .pyc, and .class files
@trevorwhitney
trevorwhitney / SimpleHttpServer.kt
Created October 24, 2018 22:50
Simplest Java HTTP Server in Kotlin
package io.pivotal
import com.sun.net.httpserver.HttpExchange
import com.sun.net.httpserver.HttpHandler
import com.sun.net.httpserver.HttpServer
import java.net.InetSocketAddress
fun main(args: Array<String>) {
val server = HttpServer.create(InetSocketAddress(8000), 0)
server.createContext("/test", MyHandler())
@phoe
phoe / lzma_sample.cpp
Created July 7, 2017 10:55 — forked from Treeki/lzma_sample.cpp
simple LZMA SDK compression/decompression example
// note: -D_7ZIP_ST is required when compiling on non-Windows platforms
// g++ -o lzma_sample -std=c++14 -D_7ZIP_ST lzma_sample.cpp LzmaDec.c LzmaEnc.c LzFind.c
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <memory>
#include "LzmaEnc.h"
#include "LzmaDec.h"
@novacrazy
novacrazy / stacktrace
Created July 9, 2015 18:16
Long stack trace example
ReferenceError: Input is not defined
at AdvancedSearchForm.render (~/example.com/views/user/forms/advanced_search.jsx:50:42)
at ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext (~/example.com/node_modules/react/lib/ReactCompositeComponent.js:789:34)
at ReactCompositeComponentMixin._renderValidatedComponent (~/example.com/node_modules/react/lib/ReactCompositeComponent.js:816:14)
at wrapper [as _renderValidatedComponent] (~/example.com/node_modules/react/lib/ReactPerf.js:70:21)
at ReactCompositeComponentMixin.mountComponent (~/example.com/node_modules/react/lib/ReactCompositeComponent.js:237:30)
at wrapper [as mountComponent] (~/example.com/node_modules/react/lib/ReactPerf.js:70:21)
at Object.ReactReconciler.mountComponent (~/example.com/node_modules/react/lib/ReactReconciler.js:38:35)
at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (~/example.com/node_modules/react/lib/ReactMultiChild.js:192:44)
at ReactDOMComponent.Mixin
@caseywatts
caseywatts / bookmarkleting.md
Last active April 12, 2025 09:23
Making Bookmarklets

This is one chapter of my "Chrome Extension Workshops" tutorial, see the rest here: https://gist.github.com/caseywatts/8eec8ff974dee9f3b247

Unrelated update: my book is out! Debugging Your Brain is an applied psychology / self-help book

Making Bookmarklets

I'm feeling very clever. I've got this sweet line of javascript that replaces "cloud" with "butt". My mom would LOVE this, but she doesn't computer very well. I'm afraid to show her the Developer Console and have her type/paste this in. But she IS pretty good at bookmarks, she knows just how to click those!

A bookmark normally takes you to a new web page. A bookmarklet is a bookmark that runs javascript on the current page instead of taking you to a new page. To declare that it is a bookmarklet, the "location" it points to starts with javascript:.

@gitaarik
gitaarik / git_submodules.md
Last active April 13, 2025 18:24
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@domenic
domenic / README.md
Last active June 24, 2021 16:37
Using promises in a UI context

The scenario:

  • We are writing a digital textbook-reading app.
  • Most of the time you have a "basic" license for your textbook, but one (and only one) of your computers can request an "enhanced" license.
  • You can only print from the computer with the enhanced license.

The problem statement: