Skip to content

Instantly share code, notes, and snippets.

View davydka's full-sized avatar
💐

David Whitely davydka

💐
View GitHub Profile
@davydka
davydka / gist:f58f7fc8b71551f7bc47
Last active December 4, 2015 19:34
constrain values
scale(x, in_min, in_max, out_min, out_max){
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
@davydka
davydka / gist:485d6156c4b38749e399
Created June 15, 2015 16:13
generic slideshow
function Slideshow(){
$('.module-slideshow').each(function(index, item){
var width = 0, height;
$(item).find('.module-slideshow__item').each(function(index1, item1){
width += + $(item1).width()+3;
$(item1).width($(item1).width());
$(item1).height($(item1).height());
});
@davydka
davydka / Edge Notes.md
Last active September 10, 2015 13:48
Adobe Edge HTML5 Banners

Here are the steps we've found for creating an html5 banner using Adobe Edge.

  1. Open Edge
  • Create New
  • Open the html file created in your project and add the following code in the header, before the Adobe Edge Runtime comment: <meta name="ad.size" content="width=728,height=90"><script>var clickTag = "http://www.google.com";</script> Be sure to change the height and width to the appropriate size of your ad.
  • And finally, wrap div#Stage in an anchor tag. Be sure to mantain the proper classname. For instance: `

First use this html (this is from a Middleman template):

<a class="share-anchor" id="share_<%= $share_count %>" href="#share_<%= $share_count %>"></a>
<div class="share">
  <ul class="share__tools"
    data-title="<%= title %>"
    data-handle="<%= current_page.data.share.handle %>"
    data-deeplink="<%= deeplink %>"
    data-subject="<%= subject %>"
who
https://vimeo.com/4856917#t=00m56s
what
https://vimeo.com/4856917#t=02m40s
example intro
https://vimeo.com/4856917#t=22m05s
example intro2
https://vimeo.com/4856917#t=22m32s
example play
https://vimeo.com/4856917#t=23m30s
@davydka
davydka / instructions.md
Created October 25, 2016 18:40
Master Controller Update Instructions

#Master Controller Update Instructions

  • Login to each Master Controller through LogMeIn
  • Open a Terminal
  • cd ~/Sites/hearst-window
  • git pull
  • Any running process should detect changes and restart automatically.
  • pm2 logs to view process logs.
@davydka
davydka / WSL+X11.md
Last active June 7, 2024 17:29
X11 setup for Windows Susbsytem for Linux (WSL)
  • Open Powershell as Administrator and run: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Open the Microsoft Store, search for Ubuntu, and install
  • Launch Ubuntu and create your Linux user
  • Open a shell into WSL (I like cmder so far: http://cmder.net/)
  • In Windows, download and install MobaXterm (free version): https://mobaxterm.mobatek.net/download.html
  • Make sure X server is running
    • You’ll always need to run MobaXterm, and in the top right corner of the app there’s an "X server" button. Make sure it’s running.
    • In mobaxterm settings -> x11 -> set OpenGL Acceleration to: Hardware
  • WSL won't have a display environment variable set by default, so tell it manually to connect to the first display: export DISPLAY=:0.0
  • Test an x11 app: sudo apt-get install x11-apps
@davydka
davydka / readme.md
Last active October 28, 2018 22:11
python dev setup
@davydka
davydka / README.md
Created February 6, 2019 18:12
https: node http-servers with ssl for https
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem


http-server -S -C cert.pem -o
Starting up http-server, serving ./ through https
Available on:
  https:127.0.0.1:8080
  https:192.168.1.101:8080
 https:192.168.1.104:8080
@davydka
davydka / scale map zmap lmap lerp clamp invlerp range
Last active September 20, 2019 18:10
scale map zmap lmap lerp clamp invlerp range
const scale = (num, in_min, in_max, out_min, out_max) => {
return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
const lerp = (x, y, a) => x * (1 - a) + y * a;
const clamp = (a, min = 0, max = 1) => Math.min(max, Math.max(min, a));
const invlerp = (x, y, a) => clamp((a - x) / (y - x));
const range = (x1, y1, x2, y2, a) => lerp(x2, y2, invlerp(x1, y1, a));