Skip to content

Instantly share code, notes, and snippets.

View uiur's full-sized avatar

Kazato Sugimoto uiur

View GitHub Profile
var list = require('./list.json');
var fs = require('fs');
var page = require('webpage').create();
var result = require('./result.json') || {};
var finalize = function(){
fs.write('result.json', JSON.stringify(result),'w');
phantom.exit()
}
var failSeach = function(text) {
return !(text.indexOf('画像が大きすぎるか、') === -1 &&
@ericboehs
ericboehs / gist:7125105
Created October 23, 2013 19:30
Poltergeist hack to silence CoreText performance notes from phantomjs
module Capybara::Poltergeist
class Client
private
def redirect_stdout(to)
prev = STDOUT.dup
prev.autoclose = false
$stdout = to
STDOUT.reopen(to)
prev = STDERR.dup
@iansinnott
iansinnott / docker_wrapper.sh
Last active March 20, 2016 12:29
Automatically set up boot2docker on a Mac whenever `docker` is called
#!/bin/bash
# A wrapper for the docker binary. Checks to make sure the docker host is
# set before executing docker commands.
docker() {
# Start the daemon if it's not running
if [ $(boot2docker status) != 'running' ]; then
echo 'Starting the Docker daemon.'
boot2docker start
@jbrowning
jbrowning / some_spec.coffee
Last active April 25, 2016 23:38
Angular & CoffeeScript: Error: [ng:areq] Argument 'fn' is not a function, got Object
# The $provide service is used to override an injected dependency
# Bad - results in Error: [ng:areq] Argument 'fn' is not a function, got Object
module 'someModule', ($provide) ->
$provide.value "SomeService", SomeMock
# Good
module 'someModule', ($provide) ->
$provide.value "SomeService", SomeMock
null
#!/bin/bash
POST_INIT_SYNC_DELAY=60
POLL_DELAY=60
STALL_THRESHOLD=5
BTCCTL='docker exec btcd btcctl --rpcuser=YOUR_USER --rpcpass=YOUR_PASS --rpccert=/rpc/rpc.cert '
stalls=0
echo "Starting watcher..."
while true; do
@tmiz
tmiz / CoreLocationTest.m
Created December 1, 2011 12:08
Using CoreLocation on Mac OS X with command-line
//
// Using CoreLocation on Mac OS X with command-line
// $ clang CoreLocationTest.m -framework cocoa -framework CoreLocation
// $ ./a.out
// location service enabled
// 2011-12-01 21:03:01.839 a.out[10214:903] latitude,logitude : 35.606647, 140.695538
// 2011-12-01 21:03:01.842 a.out[10214:903] timestamp : 2011-12-01 21:01:36 +0900
// tmiz moo@tmiz.net
//
#import <cocoa/cocoa.h>
@nderkach
nderkach / ios_github_gif.md
Last active February 15, 2024 23:31
How to record iOS screen and share it on github

Record a screencast with QuickTime Player

  1. Connect an iOS defice with a cable
  2. In QuickTime Player: Option-Cmd-N (New Movie Recording) -> Select your device from the recording menu:

http://cl.ly/image/1w0y3Y0H2g2X/record.png

Install gifify

# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@dergachev
dergachev / ssh-forward-clipboard.md
Last active March 12, 2024 00:00
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am