Skip to content

Instantly share code, notes, and snippets.

View obonyojimmy's full-sized avatar
💻
probably coding

jimmycliff obonyo obonyojimmy

💻
probably coding
View GitHub Profile
@obonyojimmy
obonyojimmy / paginate.php
Created August 17, 2018 00:11 — forked from vluzrmos/paginate.php
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@obonyojimmy
obonyojimmy / yarm.config
Created October 30, 2018 18:57 — forked from gssbzn/yarm.config
Elastic Beanstalk Rails+Webpacker extension
# Copyright 2018 SwiftComply.com
commands:
01_node_install:
test: "[ `node --version` != 'v8.10.0' ]"
command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -"
02_yarn_repo:
test: "[ ! -f /etc/yum.repos.d/yarn.repo ]"
command: "curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo"
03_yarn_install:
test: "[ ! -x /usr/bin/yarn ]"
@obonyojimmy
obonyojimmy / mongoUrlExample.md
Created November 8, 2018 21:12 — forked from cfnelson/mongoUrlExample.md
example of MONGO_URL & MONGO_OPLOG_URL
{
  "galaxy.meteor.com": {
    "env": {
      "ENV": "staging",
      "MONGO_URL": "mongodb://okgrow-staging-meteor:[email protected]:27017,okgrow-staging-shard-00-01-fxnj9.mongodb.net:27017,okgrow-staging-shard-00-02-fxnj9.mongodb.net:27017/admin?ssl=true&replicaSet=okgrow-staging-shard-0",
      "MONGO_OPLOG_URL": "mongodb://okgrow-staging-oplog:[email protected]:27017,okgrow-staging-shard-00-01-fxnj9.mongodb.net:27017,okgrow-staging-shard-00-02-fxnj9.mongodb.net:27017/local?authSource=admin&ssl=true&replicaSet=okgrow-staging-shard-0",
    }
  }
}
@obonyojimmy
obonyojimmy / aws_mongo.sh
Created November 20, 2018 00:01 — forked from wizact/aws_mongo.sh
Preparing and running an aws instance for Mongo
#!/bin/bash
set -e
install_mongo() {
sudo yum -y update
echo "[MongoDB]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
@obonyojimmy
obonyojimmy / setup-mongodb.sh
Created November 20, 2018 01:51 — forked from moshest/setup-mongodb.sh
Setup Mongodb Server on Amazon EC2
#!/usr/bin/env bash
# usage: wget -N https://gist.githubusercontent.com/moshest/e4c73efc8d6a35971f6e/raw/setup-mongodb.sh && sh ./setup-mongodb.sh
set -e
# configs
read -e -p "Replica set name: " -i "rep1" replSet
read -e -p "Hostname: " -i $(curl -s http://169.254.169.254/latest/meta-data/public-hostname) hostname
read -e -p "Swap size: " -i "8G" swapsize
@obonyojimmy
obonyojimmy / count_children.sh
Created December 2, 2018 02:15 — forked from radu-gheorghe/count_children.sh
Query parents and count children
#cleanup first
curl -XDELETE localhost:9200/test/
echo
#create index
curl -XPUT localhost:9200/test
echo
#create parent type
curl -XPUT localhost:9200/test/test_parent
@obonyojimmy
obonyojimmy / .babelrc
Created January 23, 2019 04:10 — forked from hexsprite/.babelrc
Using Istanbul wth Meteor
{
"env": {
"meteor:coverage": {
"plugins": ["istanbul"]
}
}
}
@obonyojimmy
obonyojimmy / blogpost_oauth_meteor_jimmy.md
Created January 30, 2019 22:22 — forked from lukasvan3l/blogpost_oauth_meteor_jimmy.md
Any OAuth login service ever created, added to your app within 5 minutes

Adding any OAuth login to your Meteor app

tl;dr: Copy the q42:accounts-microsoft and q42:microsoft package, modify the URLs and service name and it works! Probably anyway...

When creating a commercial application with a wide target audience, you can stumble upon users wanting to login using an unknown and barely used OAuth service. And why deny your users this when you can easily create a login service package?

With only about 400 million active users and only 2nd place as world most valuable brand it makes sense that no developer has created an implementation to log in with your Microsoft account. But believe it or not, some people like logging in with their Microsoft Account. And so, by building on the the default meteor google and [accounts-google](https://atmospherejs.com/me

@obonyojimmy
obonyojimmy / jinja2_file_less.py
Created February 5, 2019 20:24 — forked from wrunk/jinja2_file_less.py
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@obonyojimmy
obonyojimmy / build.sh
Created March 1, 2019 23:41 — forked from russelldavies/build.sh
AWS Lambda Weasyprint
#!/bin/sh
mkdir task
cp build_weasyprint.sh task
docker run --rm -it -v $PWD/task:/var/task \
-e LD_LIBRARY_PATH='/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib' \
lambdalinux/baseimage-amzn build_weasyprint.sh