Skip to content

Instantly share code, notes, and snippets.

View fukuiretu's full-sized avatar
:octocat:
Working from home

Retu Fukui fukuiretu

:octocat:
Working from home
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@nowri
nowri / gist:1916187
Last active October 12, 2017 07:10
URLからクエリ値取得
/**
* @see http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx
*/
<script type="text/jscript" language="javascript">
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
#!/bin/bash
SOURCEINSTANCE=${SOURCEINSTANCE:-''}
SOURCEUSER=${SOURCEUSER:-'admin'}
SOURCEPORT=${SOURCEPORT:-'5439'}
SOURCEDB=${SOURCEDB:-'db'}
SOURCESCHEMA=${SOURCESCHEMA:-'public'}
SCHEMA=${SCHEMA:-'public'}
echo "CREATE TABLE ${SCHEMA}.${TABLE} ("
psql -h ${SOURCEINSTANCE} -U ${SOURCEUSER} -p ${SOURCEPORT} ${SOURCEDB} -t -c "select (\"column\" || ' ' || type || ' ENCODE ' || encoding || ',' ) from pg_table_def where schemaname='$SCHEMA' and tablename = '$TABLE'" | sed 's/ENCODE none/ENCODE RAW/' | sed '$d' | sed '$ s/,$//'
echo ")"
@Stanback
Stanback / nginx.conf
Last active February 4, 2022 18:05
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender).Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
# Note (November 2016):
# This config is rather outdated and left here for historical reasons, please refer to prerender.io for the latest setup information
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
@kskb
kskb / rails new
Last active December 10, 2015 06:08
rails new する時のオプションを毎回忘れるのでメモ
// $ rails new fuga --skip-bundle --skip-test-unit -d sqlite3
$ cd fuga
$ bundle install --path vendor/bundle --without production
@melborne
melborne / atom_creating_a_package.ja.md
Created March 22, 2014 09:16
Atom.io Document Translations
@sonots
sonots / treasuredata.repo
Created May 20, 2014 04:57
for td-agent2
[treasuredata]
name=TreasureData
baseurl=http://td-agent-repository.s3-website-us-east-1.amazonaws.com/redhat/$releasever/$basearch
gpgcheck=1
gpgkey=http://packages.treasure-data.com/redhat/RPM-GPG-KEY-td-agent
@bookwyrm
bookwyrm / account.rb
Last active May 24, 2023 11:04
Cleaning up Rails app signup with Devise and Reform
class Account < ActiveRecord::Base
has_many :users
end
@selaromi
selaromi / make-flashlight-work-on.yosemite.md
Last active July 25, 2023 19:21
Steps to make Flashlight work on 10.10.4 (doesn't work for El Capitan)

Make Flashlight work on 10.10.4

  1. Install SIMBL http://culater.net/software/SIMBL/SIMBL.php
  2. Copy SpotlightSIMBL.bundle to /Library/Application Support/SIMBL/Plugins/ (a)
  3. Copy Flashlight.osax to ~/Library/ScriptingAdditions/ (b)
  4. Disable Flashlight
  5. Enable Flashlight
  6. Open Script Editor on your Mac (look for "Script Editor In Spotlight") and paste the following code (don't change Snow Leopard for Yosemite)
tell application "Spotlight" to inject SIMBL into Snow Leopard
@miguelmota
miguelmota / Makefile
Last active June 11, 2024 00:17
Makefile docker push to AWS Elastic Container Registry (ECR)
# Login to AWS registry (must have docker running)
docker-login:
$$(aws ecr get-login --no-include-email --region us-east-1 --profile=mycompany)
# Build docker target
docker-build:
docker build -f Dockerfile --no-cache -t mycompany/myapp .
# Tag docker image
docker-tag: