This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// THE CONTEXT REFERENCE | |
const MyCounterContext = createContext<{ counter: number, setCounter: (n: number) => void }>({ counter: 0, setCounter: () => { } }) | |
// PROVIDES ITS STATE TO CHILDREN COMPONENTS | |
const MyParent = ({ children }) => { | |
const [counter, setCounter] = useState(0) | |
return <MyCounterContext.Provider value={{ counter, setCounter }}> | |
{children} | |
</MyCounterContext.Provider> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent } from 'react'; | |
import { | |
View, | |
Dimensions, | |
Platform | |
} from 'react-native'; | |
export default class ViewPagerWrapper extends PureComponent { | |
constructor(props) { | |
super(props); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate a private key => address from a passphrase | |
const passphrase = process.argv[2]; | |
if(!passphrase) { | |
console.log("Usage: node app 'your-passphrase-here'"); | |
process.exit(); | |
} | |
const EthUtil = require("ethereumjs-util") | |
const Web3 = require('web3') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.directive('uploader', ['$http', '$q', 'notification', '$state', function ($http, $q, notification, $state) { | |
return { | |
restrict: 'E', | |
scope: { | |
prefix: '&', | |
suffix: '&' | |
}, | |
link: function ($scope) { | |
$scope.uploaded = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extra info: | |
# https://firebase.google.com/docs/ios/setup | |
react-native init Twins | |
cd Twins | |
react-native run-ios | |
yarn add react-native-fcm | |
react-native link react-native-fcm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TO DO | |
# - Replace '9000' with your local port | |
# | |
# - Run certbot to geherate a certificate for domain-name.com and uncoment the HTTPS section below | |
# $ certbot certonly --webroot -w /var/www/certbot -d www.domain-name.com -d domain-name.com | |
upstream app-server { | |
ip_hash; | |
server: localhost:9000; | |
# server: localhost:9001; # used if clustering is available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto'); | |
function digestPwd(password){ | |
var shasum = crypto.createHash('sha1'); | |
shasum.update(password); | |
return shasum.digest('hex'); | |
} | |
module.exports = digestPwd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These are de default settings | |
// They may be overriden by the values in cofig-production.js if NODE_ENV=production | |
// They may also be averriden if an environment variable with the same name is set | |
// WARNING: Do not include this file directly. Use config.js instead | |
module.exports = { | |
DEBUG: true, | |
COMPONENT_NAME: 'PROJECT API', | |
HTTP_PORT: 8000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:ft=zsh ts=2 sw=2 sts=2 | |
# | |
# agnoster's Theme - https://gist.github.com/3712874 | |
# A Powerline-inspired theme for ZSH | |
# | |
# # README | |
# | |
# In order for this theme to render correctly, you will need a | |
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). | |
# Make sure you have a recent version: the code points that Powerline |
NewerOlder