Skip to content

Instantly share code, notes, and snippets.

View barrylachapelle's full-sized avatar

Barry Lachapelle barrylachapelle

View GitHub Profile
@dani-mp
dani-mp / ReactNavigation4+Context.js
Last active February 25, 2020 13:33
React Navigation (v1/2/3/4) Navigator wrapped in a React Context Provider
// So we have a context...
const Context = React.createContext();
class Provider extends React.Component {
addTodo = todo => this.setState(({ todos }) => ({ todos: [...todos, todo] }));
state = {
todos: [],
addTodo: this.addTodo
@sgelbart
sgelbart / firebase-example.html
Created December 10, 2017 22:39
A simple firebase example for reading and writing database records realtime.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Order Form</title>
@lohenyumnam
lohenyumnam / How to use CoreLocation in iOS using Swift 4.swift
Last active May 13, 2021 21:53
How to use CoreLocation in iOS using Swift 4 to get your location Speed, Floor, timestamp, Course Direction, Altitude above sea level
// How to use CoreLocation to get your location Speed, Floor, timestamp, Course Direction, Altitude above sea level
//TODO: Step 1 ####################################################################
// First of all import "CoreLocation"
import CoreLocation
//TODO: Step 2 ####################################################################
@codediodeio
codediodeio / index.js
Created June 28, 2017 15:54
Firebase Cloud Functions image thumbnail generator using Sharp for 4x faster resizing
const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const sharp = require('sharp')
const _ = require('lodash');
const path = require('path');
const os = require('os');
exports.generateThumbnail = functions.storage.object('uploads/{imageId}').onChange(event => {
const object = event.data; // The Storage object.
@trilliwon
trilliwon / uiimage-data.swift
Last active January 12, 2024 14:45
Swift UIImage to Data, Data to UIImage
// Swift4
let image = UIImage(named: "sample")
let data = image?.pngData()
let data = image?.jpegData(compressionQuality: 0.9)
let uiImage: UIImage = UIImage(data: imageData)
// deprecated
// var imageData: Data = UIImagePNGRepresentation(image)
@adactio
adactio / urtext.html
Last active May 7, 2016 02:06
December 3rd, 1990: The earliest known HTML document: http://www.w3.org/2012/08/history-of-the-web/origins.htm
<h1>Standardisation</h1>
There was not a lot of discussion of this at <a href=Introduction.html>ECHT90</a>, but there seem to be two leads:
<ol>
<li><a href=People.html#newcombe>Steve newcombe's</a> and Goldfarber's "Hytime" committee
looking into SGML, and
<li>An ISO working group known as MHEG, "Multimedia/HyperText Expert Group".
led by one Francis Kretz (Thompsa SA? Rennes?).
</lo>
@debashisbarman
debashisbarman / README.md
Last active February 15, 2024 02:19
A boilerplate Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

Creating a Twitter bot with Node.js

Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

Tools we need

Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@maogm12
maogm12 / pie-pure-css.html
Last active October 18, 2019 03:54
Pie Chart in Pure CSS
<div id="skills">
<div id="part1" class="circle animate"></div>
<div id="part2" class="circle animate"></div>
<div id="part3" class="circle animate"></div>
<div id="part4" class="circle animate"></div>
<div id="part5" class="circle animate"></div>
<div id="part6" class="circle animate"></div>
</div>
@marcboeren
marcboeren / 1.UIStoryboardSegueFromRight.swift
Created March 19, 2015 20:02
Segue from Right (Slide the next controllers view in from right to left (and back))
import UIKit
class UIStoryboardSegueFromRight: UIStoryboardSegue {
override func perform()
{
let src = self.sourceViewController as UIViewController
let dst = self.destinationViewController as UIViewController
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
@SrikanthKrish
SrikanthKrish / RGB.ino
Created June 20, 2012 09:55
code for Arduino to correctly parse comma separated values of red, green and blue colors.
/*
* rgb values are sent to the arduino board and as a comma seperated list of decimal codes of 0-255
* for example rgb could look like this 213,89,46.
* This program accepts these codes form serial comm port and seperates rgb values using (,) comma as the seperator
* and sends them to the leds
*/
// global variable declarations
int incomingByte = 0; // to hold incoming serial data