Skip to content

Instantly share code, notes, and snippets.

View kre1z0's full-sized avatar
:octocat:
CSS archbishop

Igor kre1z0

:octocat:
CSS archbishop
  • Ukraine, Khmelnytskyi
View GitHub Profile
@realmyst
realmyst / gist:1262561
Created October 4, 2011 19:34
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
@gre
gre / easing.js
Last active June 27, 2024 15:37
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@jboner
jboner / latency.txt
Last active July 23, 2024 14:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@snowman-repos
snowman-repos / gist:3820279
Last active May 31, 2023 21:34
JavaScript: Array of Country Names
var country_list = ["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua &amp; Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia &amp; Herzegovina","Botswana","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Cayman Islands","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica","Cote D Ivoire","Croatia","Cruise Ship","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary",
@neilkennedy
neilkennedy / countries.js
Created September 3, 2013 13:07
GeoJSON Polygons of world countries. Easy to use in OpenLayers Raw coordinates originally found at http://mbostock.github.io/protovis/ex/countries.js
/*
* Coordinates found at Web Address : http://mbostock.github.io/protovis/ex/countries.js
* Original link Found : http://stackoverflow.com/a/6325428/814290
* Converted to GeoJSON here so we don't have to manipulate the data for OpenLayers.
*
* Can use linq.js (http://linqjs.codeplex.com/) to query.
* var country = $.Enumerable.From(countries).Where("x => x.code == 'IE'").FirstOrDefault();
*/
var countries = [{
@tylerbuchea
tylerbuchea / JSKeyCodes
Created December 17, 2013 19:58
List of JavaScript key codes.
backspace 8
tab 9
enter 13
shift 16
ctrl 17
alt 18
pause/break 19
caps lock 20
escape 27
page up 33
@HoughIO
HoughIO / power.js
Created March 1, 2014 02:03
Wowhead JS
if (typeof $WH == "undefined") {
$WH = {
wowheadRemote: true
}
}
$WH.isTouch = function () {
if (!$WH.wowheadRemote && typeof Platform != "undefined") {
$WH.isTouch = function () {
return Platform.isTouch()
}
@mfyz
mfyz / resize_preview.html
Created April 8, 2014 21:49
HTML5 FileReader + canvas resizer to resize & preview before upload an image using jquery.
<!DOCTYPE html>
<html>
<head>
<title>Angular HTML5 Preview, Crop And Upload</title>
<style>
body {
padding: 50px;
font: 16px Helvetica;
}
@vitorbritto
vitorbritto / regex.md
Last active June 16, 2024 23:15
Regex Cheat Sheet

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
@iansltx
iansltx / _safari-iframe-cookie-workaround.md
Last active April 7, 2024 15:44
Safari iframe cookie workaround