Skip to content

Instantly share code, notes, and snippets.

View logicaroma's full-sized avatar

Ramin Mohammadi logicaroma

View GitHub Profile
@logicaroma
logicaroma / conditionalwrap.js
Created April 1, 2022 11:47 — forked from kitze/conditionalwrap.js
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@logicaroma
logicaroma / post-merge
Created November 29, 2018 21:07 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
<script src="https://rawgit.com/angular/bower-angular/master/angular.min.js"></script>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
svg {
@logicaroma
logicaroma / Docker shell commands.sh
Created March 28, 2016 22:35 — forked from bahmutov/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
@logicaroma
logicaroma / bundle.js
Created March 11, 2016 14:28 — forked from jackgill/bundle.js
A node.js script to create a bundle containing an npm package, and all of its dependencies.
/*
* This script will download a package (and all of its dependencies) from the
* online NPM registry, then create a gzip'd tarball containing that package
* and all of its dependencies. This archive can then be copied to a machine
* without internet access and installed using npm.
*
* The idea is pretty simple:
* - npm install [package]
* - rewrite [package]/package.json to copy dependencies to bundleDependencies
* - npm pack [package]
@logicaroma
logicaroma / pre-commit
Created November 1, 2015 20:21 — forked from pgilad/pre-commit
Precommit git hook
#!/bin/sh
JS_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "(.js|.es6)$")
if [ "$JS_FILES" = "" ]; then
exit 0
fi
pass=true
for file in $JS_FILES; do
@logicaroma
logicaroma / Instructions.md
Created November 1, 2015 20:20 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

@logicaroma
logicaroma / gist:2c20f62ce85f0274e6f1
Last active November 27, 2017 19:20 — forked from taylanpince/gist:28e483c2dc81f99e95aa
OV7670+FIFO Simple Data Test
// OV7670+FIFO Simple Data Test
//
// OV7670 Arduino
// 3V3 3.3V
// GND GND
// SYNC 2
// D0-D7 6-13
//
void setup() {
@logicaroma
logicaroma / gist:0957f323ccfdfc180277
Last active November 27, 2017 19:20 — forked from freespace/gist:2585921
"Start InitOV7670 test program"
#define SIO_C 2
#define SIO_D 4
#define SIO_CLOCK_DELAY 100
void setup()
{
pinMode(8,OUTPUT);
// while(1)
// {
pandoc -t html5 --template=template-revealjs.html --standalone --section-divs --variable theme="beige" --variable transition="concave" slides.md -o slides.html --mathjax --include-in-header=slides.css