Skip to content

Instantly share code, notes, and snippets.

View plusjade's full-sized avatar
🐵
🚀 🤖

Jade Dominguez plusjade

🐵
🚀 🤖
View GitHub Profile
@staltz
staltz / introrx.md
Last active April 18, 2024 05:34
The introduction to Reactive Programming you've been missing
@mikeyk
mikeyk / gist:1329319
Created October 31, 2011 22:56
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@clintongormley
clintongormley / gist:4095280
Created November 17, 2012 12:00
Using synonyms in Elasticsearch

We create an index with:

  • two filters: synonyms_expand and synonyms_contract
  • two analyzers: synonyms_expand and synonyms_contract
  • three text fields:
    • text_1 uses the synonyms_expand analyzer at index and search time
    • text_2 uses the synonyms_expand analyzer at index time, but the standard analyzer at search time
    • text_3 uses the synonyms_contract analyzer at index and search time

.

@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() {
@thijsc
thijsc / gist:1391107
Created November 24, 2011 11:08
Select item from chosen js select with Capybara and Selenium
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end
@Jesus
Jesus / config_files.rb
Last active February 21, 2021 10:44
Config. file uploader task for Capistrano 3
# lib/capistrano/tasks/config_files.cap
#
# Capistrano task to upload configuration files outside SCM
# Jesus Burgos Macia
#
# This allows us to have server's config files isolated from development ones.
# That's useful for several reasons, but the most important is that you can
# ignore files from repository.
#
# The task will upload all files found in
@razor-x
razor-x / README.md
Last active February 19, 2020 10:26
Load GitHub Gists asynchronously and optionally specify which file to show.

Load GitHub Gists asynchronously

This is now a Bower package: [gist-async]. [gist-async]: https://github.com/razor-x/gist-async

Requires jQuery.

Jekyll plugin included that modifies the gist markup added by its gist Liquid tag.

Load GitHub Gists asynchronously and optionally specify which file to show.

@michael-harrison
michael-harrison / test_multi_select.rb
Created November 18, 2012 00:37
jQuery Chosen Testing with Capybara
=begin
Notes
=====
Labels: On the label you should put a "for" attribute if you're not using something like simple_form
This helps capybara to find your field
e.g. <label for="my_field_id">Some label</label>
=end
field = "Label on my field"
value = "existing option in list"
@daneden
daneden / Readme.md
Last active April 12, 2016 04:09
Aspirational Dropbox SCSS Guidelines (Draft)
@indolent-gnathostome
indolent-gnathostome / pagination.rb
Last active December 31, 2015 10:38
Independent, sortable pagination for ruhoh.rb (plugin)
module SortablePaginator
# provides helpful metrics for the paginator and mustache templates
def paginator_data
per_page = config["paginator"]["per_page"] rescue 5
paginator_sort = config["paginator"]["sort"] rescue 'desc'
current_page = master.page_data['current_page'].to_i
post_count = all.length
page_count = (post_count.to_f/per_page).ceil
if paginator_sort == 'asc'