Skip to content

Instantly share code, notes, and snippets.

View joshed-io's full-sized avatar

Josh Dzielak joshed-io

View GitHub Profile
@dteoh
dteoh / rspec_rails_set_session.md
Created May 29, 2020 07:49
Setting session variables in an RSpec Rails request spec

Setting session variables in an RSpec Rails request spec

You are writing a spec with type: :request, i.e. an integration spec instead of a controller spec. Integration specs are wrappers around Rails' ActionDispatch::IntegrationTest class. I usually write controller tests using this instead of type: :controller, mainly because it exercises more of the request and response handling stack. So instead of writing something like get :index to start the request, you would write get books_path or similar.

One of the issues with using type: :request is that you lose the ability to

@philhawksworth
philhawksworth / conference-mc-tips.md
Last active February 13, 2023 21:52
Conference MC-ing tips

👀📎 It looks like you're preparing to MC a conference...

🚨 GIANT DISCLAIMER: This stuff is far from authoritative. But it's what I think works for me, and what I enjoy in an MC when I'm attending a conference.


Biggest tip - enjoy yourself.

@jonathansick
jonathansick / query.graphql
Last active January 20, 2024 07:58
GitHub GraphQL repo commit history query
{
repository(name: "sickvim", owner: "jonathansick") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
@lorentzca
lorentzca / index.html
Created October 4, 2016 15:07
ghost blog insite search box by algolia
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
.algolia-autocomplete {
width: 80%;
max-width: 710px;
}
.algolia-autocomplete .aa-input, .algolia-autocomplete .aa-hint {
width: 100%;
@niklasvincent
niklasvincent / projects.html
Created July 30, 2015 13:27
Public Github repositories sorted by number of watchers
{% if site.github.public_repositories %}
{% assign sorted_repositories = site.github.public_repositories | sort: 'watchers_count' %}
{% for repository in sorted_repositories reversed %}
<h2><a href="{{ repository.html_url }}" target="_blank">{{ repository.name }}</a></h2>
<p>{{ repository.description }}</p>
{% endfor %}
{% endif %}

"A beginning programmer writes her programs like an ant builds her hill, one piece at a time, without thought for the bigger structure. Her programs will be like loose sand. They may stand for a while, but growing too big they fall apart.

Realizing this problem, the programmer will start to spend a lot of time thinking about structure. Her programs will be rigidly structured, like rock sculptures. They are solid, but when they must change, violence must be done to them.

The master programmer knows when to apply structure and when to leave things in their simple form. Her programs are like clay, solid yet malleable."

-- Master Yuan-Ma, The Book of Programming

@plamere
plamere / parse.py
Last active August 29, 2015 14:04
parses outside lands lineup and generates a json of artists along with Spotify, Echo Nest and Rdio IDs
import sys
from bs4 import BeautifulSoup
import json
import pyen
en = pyen.Pyen()
def get_fid(artist, idspace):
if 'foreign_ids' in artist and len(artist['foreign_ids']) > 0:
for fids in artist['foreign_ids']:
if fids['catalog'] == idspace:
@wetzler
wetzler / gist:2ef7d45072cf4d92c16f
Last active August 29, 2015 14:04
Pull and sort of bunch of session events from Keen IO
require 'rubygems'
require 'net/http' # This is probably not needed, did not validate which things are truly required...
require 'net/https'
require 'keen'
require 'json'
require 'date'
require 'time'
require 'set'
NUM_LATEST_SESSIONS = 1000
@weilu
weilu / auth.js
Last active August 20, 2019 15:35
Cloudant create user
var cradle = require('cradle');
var crypto = require('crypto');
cradle.setup({
host: 'foo.cloudant.com',
port: 80,
cache: false,
timeout: 5000
})
@dustinlarimer
dustinlarimer / README.md
Last active August 29, 2015 13:57
GeoCharts with Keen IO

GeoCharts with Keen IO

This recipe uses geographic properties generated by the ip_to_geo data enrichment addon.

If you would like to activate this addon for your project, just ask!

The team is available in HipChat, IRC, or at contact@keen.io.