Skip to content

Instantly share code, notes, and snippets.

View qodunpob's full-sized avatar
🥃
Drink Driven Development

Konstantin qodunpob

🥃
Drink Driven Development
View GitHub Profile
@fworks
fworks / install-zsh-windows-git-bash.md
Last active November 8, 2024 05:43
Zsh / Oh-my-zsh on Windows Git Bash
@mxstbr
mxstbr / Readme.md
Last active October 20, 2024 20:44
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
--[[------------------------------------
RandomLua v0.3.1
Pure Lua Pseudo-Random Numbers Generator
Under the MIT license.
copyright(c) 2011 linux-man
--]]------------------------------------
local math_floor = math.floor
local function normalize(n) --keep numbers at (positive) 32 bits
@traviskaufman
traviskaufman / jasmine-this-vars.md
Last active September 19, 2022 14:35
Better Jasmine Tests With `this`

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {
@P4
P4 / default.reg
Last active October 5, 2024 01:35
Color schemes for Windows Command Prompt
Windows Registry Editor Version 5.00
; Default color scheme
; for Windows command prompt.
; Values stored as 00-BB-GG-RR
[HKEY_CURRENT_USER\Console]
; BLACK DGRAY
"ColorTable00"=dword:00000000
"ColorTable08"=dword:00808080
; BLUE LBLUE
@bladeofsteel
bladeofsteel / html.part.html
Created November 25, 2012 17:51
Элементарные социальные share-кнопки. (jQuery version) see http://habrahabr.ru/post/156185/
// Пример кнопок с минимальной настройкой
<p>Поделиться:
<button class="social_share" data-type="vk">ВКонтакте</button>
<button class="social_share" data-type="fb">Facebook</button>
<button class="social_share" data-type="tw">Twitter</button>
<button class="social_share" data-type="lj">LiveJournal</button>
<button class="social_share" data-type="ok">Одноклассники</button>
<button class="social_share" data-type="mr">Mail.Ru</button>
</p>
@a-ignatov-parc
a-ignatov-parc / gist:3045497
Created July 4, 2012 05:16
Примеры форматирования чейнинга в коде
// Нету чейнинга
this.$el.find('.js-search_city-suggest');
// Чейнинг без присваивания
this.$el
.find('.js-search_city-suggest')
.typeahead();
// Чейнинг с присваиванием в переменную
var city = this.$el
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@femto113
femto113 / transpose.js
Last active September 6, 2023 00:28
one line transpose for 2-dimensional Javascript arrays
function transpose(a)
{
return a[0].map(function (_, c) { return a.map(function (r) { return r[c]; }); });
// or in more modern dialect
// return a[0].map((_, c) => a.map(r => r[c]));
}