Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View amitshahc's full-sized avatar
💭
PHP Laravel Developer, learning ReactJS, Blockchain certified

Amit Shah amitshahc

💭
PHP Laravel Developer, learning ReactJS, Blockchain certified
  • Vadodara
View GitHub Profile
@olvado
olvado / getAverageColourAsRGB.js
Created June 27, 2011 10:19
Get the average colour of an image in javascript using getImageData in CANVAS
function getAverageColourAsRGB (img) {
var canvas = document.createElement('canvas'),
context = canvas.getContext && canvas.getContext('2d'),
rgb = {r:102,g:102,b:102}, // Set a base colour as a fallback for non-compliant browsers
pixelInterval = 5, // Rather than inspect every single pixel in the image inspect every 5th pixel
count = 0,
i = -4,
data, length;
// return the base colour for non-compliant browsers
@fuzzyfox
fuzzyfox / average-color.js
Last active August 31, 2020 17:33
JavaScript: image average color
var getAverageColor = (function(window, document, undefined){
return function(imageURL, options}){
options = {
// image split into blocks of x pixels wide, 1 high
blocksize: options.blocksize || 5,
fallbackColor: options.fallbackColor || '#000'
};
var img = document.createElement('img'),
canvas = document.createElement('canvas'),
@snorpey
snorpey / average-rgba.js
Created July 13, 2013 10:18
get average color of an imagedata object (from an html5 canvas) in javascript
/*global define*/
define(
function()
{
var i;
var len;
var multiplicator = 20;
var count;
var rgba;
@joyrexus
joyrexus / README.md
Last active February 19, 2024 17:15 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@sohelamin
sohelamin / lumen-resource-route.php
Created April 20, 2015 18:34
Lumen Resource Routing
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
@lalkmim
lalkmim / codility_solutions.txt
Last active April 20, 2024 12:37
Codility Solutions in JavaScript
Lesson 1 - Iterations
- BinaryGap - https://codility.com/demo/results/trainingU2FQPQ-7Y4/
Lesson 2 - Arrays
- OddOccurrencesInArray - https://codility.com/demo/results/trainingFN5RVT-XQ4/
- CyclicRotation - https://codility.com/demo/results/trainingSH2W5R-RP5/
Lesson 3 - Time Complexity
- FrogJmp - https://codility.com/demo/results/training6KKWUD-BXJ/
- PermMissingElem - https://codility.com/demo/results/training58W4YJ-VHA/