Skip to content

Instantly share code, notes, and snippets.

View w3aran's full-sized avatar

Aran w3aran

  • Toronto, ON, Canada
View GitHub Profile
@rcbop
rcbop / Dockerfile
Created June 14, 2018 00:51
ionic dockerfile and jenkins file for CI
FROM node:8-alpine
LABEL MAINTAINER="rcbpeixoto@gmail.com"
ARG NODEJS_VERSION="8"
ARG IONIC_VERSION="3.20.0"
ARG GRADLE_VERSION="3.2"
ARG ANDROID_SDK_VERSION="4333796"
ARG ANDROID_HOME="/opt/android-sdk"
ARG GRADLE_HOME="/opt/gradle"
@rcbop
rcbop / docker-cleanup.groovy
Last active January 9, 2024 20:40
Jenkins pipeline script for Docker cleanup (remove dangling images and exited containers) in a given build agent
node("${params.BUILD_AGENT}") {
stage('Dangling Containers') {
sh 'docker ps -q -f status=exited | xargs --no-run-if-empty docker rm'
}
stage('Dangling Images') {
sh 'docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi'
}
@tkh44
tkh44 / Animation.jsx
Last active September 13, 2022 01:31
react-router v4 animated with data-driven-motion
import React from 'react'
import { BrowserRouter as Router, Route, Link, Redirect, matchPath } from 'react-router-dom'
import { Motion } from 'data-driven-motion' // https://github.com/tkh44/data-driven-motion
const WOBBLY_SPRING = { stiffness: 200, damping: 15, precision: 0.1 }
const AnimationExample = () => (
<Router>
<div>
<ul>
@adrianmcli
adrianmcli / _counter.md
Last active February 17, 2017 05:18
Increment decrement counters using various frontend frameworks.

Counter Examples

Moved to omg-counters

This is a collection of increment/decrement counters using various frontend frameworks.

The increment/decrement counter is the step between a hello world example and a todo app. Please note that the examples are supposed to be as minimal as possible.

So far we have the following:

@gaearon
gaearon / quiz.md
Last active January 11, 2024 16:56

A top-level App component returns <Button /> from its render() method.

  1. What is the relationship between <Button /> and this in that Button’s render()?

  2. Does rendering <Button><Icon /></Button> guarantee that an Icon mounts?

  3. Can the App change anything in the Button output? What and how?


@kennetpostigo
kennetpostigo / Migrating.md
Last active June 2, 2021 17:44
How I migrated from ReactRouter v2 to v4

First couple things I thought about when migrating after reading the docs

So migrating my existing app wasn't as troublesome as I originally thought. First thing I did was take a look at my router and routes and figure try to make a mental model of all the files where I had nested routes in the existing app because those components/containers will contain {this.props.children}. So I need to replace those with the nested <Match /> components.

So just to give an example:

In v2:

<Router history={history}>
  <Route path="/" component={App}>
@gaearon
gaearon / index.js
Last active January 5, 2022 18:45
Breaking out of Redux paradigm to isolate apps
import React, { Component } from 'react'
import Subapp from './subapp/Root'
class BigApp extends Component {
render() {
return (
<div>
<Subapp />
<Subapp />
<Subapp />
@maliMirkec
maliMirkec / local-vagrant-dev-serv
Last active July 5, 2017 21:21
Local vagrant developement server - Vesta, PhalconPHP, Git, NodeJs, Bower, Grunt, Gulp, Yeoman
// general update
sudo apt-get update
// general upgrade
sudo apt-get upgrade
// install midnight commander
sudo apt-get install mc
// install git
@titogeorge
titogeorge / LogStash config for ELB logs
Created March 10, 2015 12:33
Logstash AWS Elasticbeanstalk access logs pattern
if [type] == 'elb-access-log' {
grok {
patterns_dir => "./patterns"
# Different elastic-access-log patterns. look for _grokfailure tag in kibana and keep adding patterns here.
match => [ "message" , [
"%{IPORHOST:elbIp} \(%{IPORHOST:clientIp}, %{IPORHOST:elbip1}\) - - \[%{HTTPDATE:timestamp}\] \"%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:response} %{NUMBER:bytes} %{QS:referrer} %{QS:agent}",
"%{IPORHOST:elbIp} \(%{IPORHOST:clientIp}, %{IPORHOST:elbip1}\) - - \[%{HTTPDATE:timestamp}\] \"%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:response} - \"-\" %{QS:agent}",
"%{IPORHOST:elbIp} \(%{IPORHOST:clientIp}, %{IPORHOST:elbip1}\) - - \[%{HTTPDATE:timestamp}\] \"%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}\" %{NUMBER:response} %{NUMBER:bytes} \"-\" %{QS:agent}",
"%{IPORHOST:elbIp} \(%{IPORHOST:clientIp}, %{IPORHOST:clientIp1}, %{IPORHOST:elbip1}\) - - \[%{HTTPDATE:timestamp}\] \"%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUM
@rothgar
rothgar / main.yml
Last active March 8, 2024 07:16
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']