Skip to content

Instantly share code, notes, and snippets.

View Nilloc's full-sized avatar

Collin Reisdorf Nilloc

View GitHub Profile
@vahidk
vahidk / colorTransform.js
Last active July 9, 2024 15:48
Convert RGB to HSL and vice versa in Javascript.
// This code is based on https://en.wikipedia.org/wiki/HSL_and_HSV
// Free to use for any purpose. No attribution needed.
function rgbToHsl(r, g, b) {
r /= 255; g /= 255; b /= 255;
let max = Math.max(r, g, b);
let min = Math.min(r, g, b);
let d = max - min;
let h;
if (d === 0) h = 0;
@liuyanghejerry
liuyanghejerry / index.html
Last active July 3, 2024 14:25
Modern index file in 2017
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#">
<head>
<!-- content-type, which overrides http equivalent header. Because of charset, this meta should be set at first. -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Overrides http equivalent header. This tells IE to use the most updated engine. -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<!-- Tells crawlers how to crawl this page, and the role of this page. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta -->
<meta name="robots" content="index, follow">
@Nilloc
Nilloc / gist:aacdab06bcbee5d3ef01
Created March 16, 2016 17:39 — forked from lopezjurip/gist:a817e96ec833e7667274
DigitalOcean+Rails+Puma+Dokku+Postgress
# Based on: http://donpottinger.net/blog/2014/11/17/bye-bye-heroku-hello-dokku.html
# Add to gemfile:
ruby '2.1.2'
gem 'pg'
gem 'puma'
gem 'rails_12factor'
gem 'searchkick'
gem 'typhoeus'
@0x1ad2
0x1ad2 / Gulpfile.js
Last active January 23, 2020 15:24
My gulpfile example for How to enhance your front-end development workflow using Gulp
/*
* 0x1ad2 base Gulp.js file
* https://twitter.com/0x1ad2
*/
/*
* Define plugins
*/
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
@jamescmartinez
jamescmartinez / slack_delete.rb
Last active May 28, 2024 15:00
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@nitaku
nitaku / README.md
Last active May 8, 2023 17:59
Three.js isometric SVG

An example showing an isometric rendering in SVG, thanks to three.js.

The example is inspired by this post on using three.js to generate illustrations for scientific papers.

@lopezjurip
lopezjurip / gist:a817e96ec833e7667274
Last active June 9, 2020 22:26
DigitalOcean+Rails+Puma+Dokku+Postgress
# Based on: http://donpottinger.net/blog/2014/11/17/bye-bye-heroku-hello-dokku.html
# Add to gemfile:
ruby '2.1.2'
gem 'pg'
gem 'puma'
gem 'rails_12factor'
gem 'searchkick'
gem 'typhoeus'
@mjackson
mjackson / color-conversion-algorithms.js
Last active July 22, 2024 15:04
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@hipertracker
hipertracker / vimeo_downloader.rb
Created January 3, 2012 20:06
Vimeo Downloader
#!/usr/bin/env ruby
=begin
Vimeo Downloader v1.0 by Jaroslaw Zabiello (http://zabiello.com)
based on http://cl.ly/2T1x180I251j301L1C3r/vimeo_downloader.sh
found thanks to http://goo.gl/AN5sf :)
Requirements:
* Ruby 1.8 or newer
* nokogiri (http://nokogiri.org)
@Nilloc
Nilloc / gist:1336952
Created November 3, 2011 16:23
Fadeout and remove objects.
$('#glass').mousedown(function(evt){
var $thumb = $('<img src="img/thumbprint.png" class="thumbprint">')
.css({top:evt.offsetY-30, left:evt.offsetX-20, opacity:1, rotation:90}) //, "-webkit-transform": "rotate("+((Math.random()*30)-15)+" deg)"
.delay(1000)
.animate({opacity:0}, 2000, function(){$(this).remove();});
$(this).append($thumb);
});