Skip to content

Instantly share code, notes, and snippets.

View dbrunonascimento's full-sized avatar

Bruno Nascimento dbrunonascimento

View GitHub Profile
@cobyism
cobyism / gh-pages-deploy.md
Last active July 18, 2024 05:22
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@turicas
turicas / bovespa.py
Last active July 20, 2020 15:15
Get stock prices from BMF Bovespa API (not working anymore)
# coding: utf-8
# WARNING: as far as I checked, this script is not working anymore.
# B3 moved to use TradingView in their own website, but there's a way
# to download daily data at:
# <http://www.b3.com.br/pt_br/market-data-e-indices/servicos-de-dados/market-data/cotacoes/cotacoes/>.
# Copyright 2015 Álvaro Justen <https://github.com/turicas/rows/>
#
# This program is free software: you can redistribute it and/or modify
@svallory
svallory / Deploying Sharetribe to Heroku.md
Last active August 12, 2023 21:09
Deploying Sharetribe to Heroku

Deploying to Heroku

  1. Deploy the app to heroku following heroku normal instructions (add link to heroku help)

  2. Set heroku environment variables

    Make sure all the options in config.yml are properly set then run:

     bundle exec rake heroku:config
    
@craigbeck
craigbeck / introspection-query.graphql
Created April 6, 2016 20:20
Introspection query for GraphQL
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
@noelboss
noelboss / git-deployment.md
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active June 28, 2024 20:49
React Native Bridging Cheatsheet
@enzoftware
enzoftware / sobel-filter.py
Last active October 5, 2021 19:03
Sobel filter in Python for edge detection 🐍
from PIL import Image
import math
path = "peru.jpeg" # Your image path
img = Image.open(path)
newimg = Image.new("RGB", (width, height), "white")
for x in range(1, width-1): # ignore the edge pixels for simplicity (1 to width-1)
for y in range(1, height-1): # ignore edge pixels for simplicity (1 to height-1)
# initialise Gx to 0 and Gy to 0 for every pixel
Gx = 0
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:

Creating your own Native Modules

Sometime when we need a specific way to interact with the phone or operator system which is various different between iOS and Android, that when we need to lean that responsibility to the OS it self.

In RN, most of the logic and UI, in the best way, must be consistent between platforms. So, In an advance level of bringing best user experience to end user, we need to create native module, that mean the leaning the logic to the Native Part. There are ton of article out there showing why and when we need to create a native module, I won't dive into explanation again. Instead, I will show you how can we create a native module that could be used in React native code. That mean, you write your Objective-C/Java code, and import and run it as a module in Javascript Code.

I will show you here the most basic way to create the most basic library, called: open https://google.com. It means, I want to open Google by using the default iOS/Android browser in a native way.

Creating re

@mindplay-dk
mindplay-dk / image-url.ts
Last active September 28, 2023 15:25
Rotate image preview to compensate for EXIF orientation (Javascript / Typescript)
// Based on: https://stackoverflow.com/a/46814952/283851
/**
* Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed.
*
* Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails.
*/
export async function getImageUrl(file: File, maxWidth: number|undefined) {
return readOrientation(file).then(orientation => applyRotation(file, orientation || 1, maxWidth || 999999));
}