Skip to content

Instantly share code, notes, and snippets.

View ponty96's full-sized avatar
🏠
Working from home

Aregbede Ayomide ponty96

🏠
Working from home
View GitHub Profile
@ponty96
ponty96 / gist:1ab50c868f5c08af5385f54e0d4bbe8c
Created May 7, 2021 01:30
Convert multipart mixed to finch command
curl -v --location --request POST "https://route.example.com/route/v2/send" --header 'Content-Type: multipart/mixed; boundary=mimeboundary' --header 'Authorization: Basic AUTH_TOKEN' --data-binary "@body_data.txt"
body_data.txt is:
--mimeboundary
Content-Type: application/json
Content-Id: main
{
defmodule Foo.Context do
@moduledoc false
defmacro __using__(modules) do
quote bind_quoted: [modules: modules] do
alias Foo.Repo
alias Ecto.Query
for module <- modules do
schema =
@ponty96
ponty96 / Rinkeby.md
Created November 29, 2017 08:21 — forked from learner-long-life/Rinkeby.md
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@ponty96
ponty96 / error_parser.ex
Created June 3, 2017 22:20
Parser for Ecto Changeset Errors
defmodule Ponty96.ToolTips.ErrorParser do
import Ponty96.ToolTips.Camelize, only: [camelize: 1]
def parse_errors(changeset) do
errors =
changeset
|> handle_changeset_errors()
|> Map.to_list
|> Enum.map(fn error ->
key = error |> elem(0) |> Atom.to_string |> camelize()
@ponty96
ponty96 / camelize.ex
Last active June 3, 2017 22:18
Camelize
defmodule Ponty96.ToolTips.Camelize do
@moduledoc false
def camelize(word), do: camelize(word, [])
def camelize(word, opts \\ [])
def camelize("_" <> word, opts) do
"_" <> camelize(word, opts)
end
def camelize(word, opts) do
case opts |> Enum.into(%{}) do

React-Native Pusher Chat

For some months now, whilst working on React-native, I stumbled upon Pusher which is a good tool for building applications which have a need for real-time message broadcasting. I'll be showing you a bit of what you could use Pusher to do along with React-Native.

In this tutorial you will be building a simple chat application with Pusher, React-native and Redux as a state container. Before we continue, I’d love to point out that this article assumes a fairly good experience with the use of node.js, react, react-native and es6.

Pusher

Pusher is a real-time communication platform used to send broadcast messages to listeners subscribed to a channel.

import ActionTypes from '../action_types'
import { push } from 'react-router-redux'
import { httpPost, httpGet, httpDelete} from '../utils'
const BusinessActions = {
currentBusiness: () => {
// api create business
return dispatch => {
// dispatch loading sign
dispatch({type: ActionTypes.BUSINESS_PROGRESS})
@ponty96
ponty96 / draft1.md
Last active May 17, 2016 09:34
Tutorial Draft

In this tutorial we will be implementing a technological stack have been playing with. We are gonna build a simple chat application with the very popular react native + redux and a realtime communication platform Pusher.

React native makes it easy to build mobile apps with native UI and high performance by just wrapping Javascript codes over native modules, you can read more here and Pusher allows you to send messages realtime via their infrastructure to as many listeners as possible;

I would like to assume you have react native set up already on your computer and that you have created an app on Pusher already.Thou its simple, just create an account here and from there create an app

So enough talk, lets get started

$ cd into_working_directory

@ponty96
ponty96 / System Design.md
Created April 18, 2016 15:51 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?