Skip to content

Instantly share code, notes, and snippets.

View fchikwekwe's full-sized avatar
🏝️

Faith Chikwekwe fchikwekwe

🏝️
View GitHub Profile
@fchikwekwe
fchikwekwe / base64-image.js
Created April 29, 2019 18:50
An example of how to save a canvas image as a base64 URL for modularity.
// Get an image dataURL from the canvas.
var imageDataURL = hidden_canvas.toDataURL('image/png');
// Set the dataURL as source of an image element, showing the captured photo.
image.setAttribute('src', imageDataURL);
@fchikwekwe
fchikwekwe / canvas-selfie.js
Last active April 29, 2019 18:46
This is a small snippet showing one way to capture the canvas context and use it to save an image. It is an example for my blog post on base64 image encoding.
var video = document.querySelector('video'),
image = document.querySelector('#selfie-image'),
// Get the exact size of the video element.
width = video.videoWidth,
height = video.videoHeight,
// Context object for working with the canvas.
context = hidden_canvas.getContext('2d');
@fchikwekwe
fchikwekwe / NumberWizardRandom
Created February 1, 2018 05:16
Learn to Code by Making Games -- Random version of Number Wizard Game
using UnityEngine;
using System.Collections;
public class NumberWizardRandom : MonoBehaviour {
// Use this for initialization
int max;
int min;
int guess;