Skip to content

Instantly share code, notes, and snippets.

View adamo's full-sized avatar
💭
I may be slow to respond.

Adam adamo

💭
I may be slow to respond.
View GitHub Profile
@adamo
adamo / rating.scss
Created November 21, 2022 10:29
Woocommerce star rating witrh custom font
.comment-form-rating .stars {
a {
position: relative;
height: 1em;
width: 1em;
text-indent: -999em;
display: inline-block;
text-decoration: none;
margin-right: 1px;
font-weight: 400;
@adamo
adamo / join_update.sql
Created November 13, 2019 10:40
Select data from one table to another matching
UPDATE table_a INNER JOIN table_b ON table_a.column_to_match = table_b.column_to_match
SET table_a.column_to_update = table_b.data_column_to_update_with
WHERE table_a.column_match_a = table_b.column_match_for_example_id
@adamo
adamo / sticky_header.js
Created May 14, 2018 08:51
Coffee script version of vanilla js sticky header
sticky =
sticky_after: 200
init: ->
@header = document.getElementsByTagName('header')[0]
@clone = @header.cloneNode(true)
@clone.classList.add 'clone'
# @header.insertBefore @clone
@scroll()
@events()
return
@adamo
adamo / gist:3cf6d41586d89fbd4877dbb4e1ea477c
Created November 3, 2017 10:12
Jaro Winkler Similarity SQL code
#from https://androidaddicted.wordpress.com/2010/06/01/jaro-winkler-sql-code/
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `jaro_winkler_similarity`( in1 varchar(255), in2 varchar(255) ) RETURNS float DETERMINISTIC BEGIN declare finestra, curString, curSub, maxSub, trasposizioni, prefixlen, maxPrefix int; declare char1, char2 char(1); declare common1, common2, old1, old2 varchar(255); declare trovato boolean; declare returnValue, jaro float; set maxPrefix=6; set common1=""; set common2=""; set finestra=(length(in1)+length(in2)-abs(length(in1)-length(in2))) DIV 4 + ((length(in1)+length(in2)-abs(length(in1)-length(in2)))/2) mod 2; set old1=in1; set old2=in2; set curString=1; while curString<=length(in1) and (curString<=(length(in2)+finestra)) do set curSub=curstring-finestra; if (curSub)<1 then set curSub=1; end if; set maxSub=curstring+finestra; if (maxSub)>length(in2) then set maxSub=length(in2); end if; set trovato = false; while curSub<=maxSub and trovato=false do if substr(in1,curString,1)=s
@adamo
adamo / gist:229c397bd2ce25928947a34e3ea7d819
Created August 17, 2016 07:58
Set Expiry header for webfonts
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
# Compress compressible fonts
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml
@adamo
adamo / .gitignore
Created February 3, 2016 13:20 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@adamo
adamo / app.coffee
Created December 22, 2015 12:05
add animated class to header on scroll vanilla js
masthead = document.getElementById("masthead")
height = 100
stop = height
window.onscroll = (e) ->
scrollTop = (if (window.pageYOffset isnt `undefined`) then window.pageYOffset else (document.documentElement or document.body.parentNode or document.body).scrollTop)
# console.log scrollTop
# masthead.offsetTop;
if scrollTop >= stop