Skip to content

Instantly share code, notes, and snippets.

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

Rodolfo Silva RodolfoSilva

🏠
Working from home
View GitHub Profile
@matthewkastor
matthewkastor / CKEditor.SourceViewReplacer.js
Last active June 1, 2017 12:12
This class allows you to easily replace the source view in CKEditor with any web based code editor e.g. Ace, Code Mirror, etc.
/*jslint
indent: 4,
maxerr: 50,
white: true,
browser: true,
vars: true
*/
/*global
CKEDITOR
*/
import React from 'react';
import { Text, View, TouchableOpacity, VibrationVibration, Dimensions } from 'react-native';
import { Camera, Permissions, FileSystem } from 'expo';
import { Ionicons, Entypo } from '@expo/vector-icons';
const { width, height } = Dimensions.get('window');
export default class CameraScreen extends React.Component {
state = {
@eduardosilva
eduardosilva / gist:8288209
Created January 6, 2014 19:21
Script to calculate age in javascript
birthday = Date.parse('2013/03/27');
age = ~~((Date.now() - birthday) / (31557600000));
create or replace function add_on_update_trigger
(schema_name text, table_name text, column_name text)
returns void AS $body$
declare
target_table text =
quote_ident(schema_name) || '.' || quote_ident(table_name);
trig_name text =
quote_ident(
'update_' || schema_name || '_' || table_name || '_' || column_name
);
@usmansaleem
usmansaleem / instructions.txt
Last active October 12, 2019 18:13
Notes on building Firebird 2.5.4 on Alpine Linux (in docker)
apk add --no-cache --virtual=build-dependencies build-base ncurses-dev icu-dev tar
apk add --no-cache --virtual=build-dependencies --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ shadow
mkdir /work && cd /work
wget -O firebird-source.tar.bz2 http://downloads.sourceforge.net/project/firebird/firebird/2.5.4-Release/Firebird-2.5.4.26856-0.tar.bz2
tar --strip=1 -xf firebird-source.tar.bz2
#Patch rwlock.h (this has been fixed in later release of firebird 3.x)
sed -i '194s/.*/#if 0/' src/common/classes/rwlock.h
@chrisrzhou
chrisrzhou / README.md
Last active December 1, 2021 09:57
D3 Radar Chart

D3 Radar Chart

bl.ocks.org link

A radar chart visualizes multivariate data in a 2D chart of three or more quantitative variables represented on axes.

The project is created using AngularJS and D3.js.


Description

@vovkab
vovkab / gist:d9f76e3429cdf20a4e0c
Created January 13, 2016 18:05 — forked from ohmrefresh/gist:55149f68c41a148ae673
How to Server-side verification of Google Play subscriptions
1.create google app (google console)
Example:
Client ID xxx.apps.googleusercontent.com
Email address xxx@developer.gserviceaccount.com
Client secret xxx
Redirect URIs
https://localhost/oauth2callback
Javascript Origins
https://localhost
@lequanghuylc
lequanghuylc / pure-react.md
Last active January 17, 2023 14:13
[Using React & React Native without State management library] #article #react

It’s common these day when React & React Native developers use State management library (like Redux). I’ve been using React & React Native for a while now and found out that Pure React is actually not bad. In this article I will share my way of doing things with React & React Native purely, without State management library (represented by Redux). 

For those of you who are struggling learning Redux, because of the overwhelming of the whole React/JSX/Babel/Webpack/Native Component/Native Module/.. and have to add Redux to the list just to solve some of React problems, or because of the high learning curve of Redux, I hope you find this article helpful.

Some of React problems with State Management

Assuming you have some knowledge of React, I will jump right in the problems that most of us encoutered at the beginning of time learning React:

  • Flow pass data down, pass event up makes us to pass data & function via props and it's hard to manage when amount of props gets huge. (Comunication between component
@baumandm
baumandm / Chakra-UI x React-datepicker.md
Last active March 4, 2023 20:56
Chakra-UI x React-datepicker

⚠️ I'd recommend using this fork by @igoro00 which has better theme support.


Tiny wrapper component for React-Datepicker to stylistically fit with Chakra-UI 1.x.

<DatePicker selectedDate={myDate} onChange={(d) => console.log(d)} />
@joshsalverda
joshsalverda / useFieldArray.js
Last active May 22, 2023 09:49
Custom useFieldArray hook for formik using immutability-helper
import {useCallback, useRef, useEffect} from 'react'
import {useField, useFormikContext} from 'formik'
import update from 'immutability-helper'
const useFieldArray = props => {
const [field, meta] = useField(props)
const fieldArray = useRef(field.value)
const {setFieldValue} = useFormikContext()
useEffect(() => {