Skip to content

Instantly share code, notes, and snippets.

View wozozo's full-sized avatar
😇
Hello

Yoichi Fujimoto wozozo

😇
Hello
  • Tokyo, Japan
  • 05:28 (UTC +09:00)
  • X @wozozo
View GitHub Profile
@hagino3000
hagino3000 / capture.js
Last active January 21, 2020 22:21
Capture screenshot using phantom.js
var page = new WebPage(),
address, output, size;
if (phantom.args.length != 2) {
console.log('Give me URL and filename');
phantom.exit();
} else {
address = phantom.args[0];
output = phantom.args[1];
page.viewportSize = { width: 1024, height: 768 };
import os
import pty
pair = pty.fork()
if not pair[0]:
os.execvp('python', ['python'])
s = os.fdopen(pair[1], 'w+')
while True:
@ojii
ojii / cbv_decorator.py
Created January 27, 2013 05:42
Class based view decorators for Django
def cbv_decorator(decorator):
"""
Turns a normal view decorator into a class-based-view decorator.
Usage:
@cbv_decorator(login_required)
class MyClassBasedView(View):
pass
"""
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@hitode909
hitode909 / access_log.webtailrc.js
Created October 31, 2012 10:13
webtailでアクセスログ聞くやつ
if (!context.setup) {
context.setup = true;
var app = {
counts: {
GET: 0,
POST: 0,
},
$log: $('<pre>').appendTo($(document.body)),
urls: [],
class Tab
constructor: ->
@$tabs = ($ '.tab')
@$sections = ($ '.section')
@_idx = 0
current_tab: =>
@$tabs.eq(@_idx)
current_section: =>
class Accessor(object):
def __init__(self, wrapper, d):
self.wrapper = wrapper
self.d = d
def __repr__(self):
return repr(self.d)
def _get_failback(self, k):
chained = self.wrapper.chained
@hail2u
hail2u / cf-email-croaking.html
Created June 20, 2012 09:11
CloudFlareのメールアドレスクローキング
<p>
<a href="http://cloudflare.com/email-protection.html#bcd7c5d3fcd4ddd5d08ec992d2d9c8">
<span id="__cf_email__" class="4c2735230c242d25207e3962222938">
[email&nbsp;protected]
</span>
<script type="text/javascript">
/* <![CDATA[ */
(function () {
try {
var s, a, i, j, r, c, l = document.getElementById("__cf_email__");
@hail2u
hail2u / test.scss
Last active October 6, 2015 07:28
レスポンシブフォwww
@mixin optimize-font-size($sizes) {
@each $r in $sizes {
$w: $safe-for-full * $r * $r;
@media (min-width: $w) {
font-size: percentage($r);
}
}
}
@sigilioso
sigilioso / cuter.py
Created June 19, 2012 22:58
Python PIL Example: get a thumbnail by resizing and cropping an image.
# -*- coding: utf-8 -*-
import Image
def resize_and_crop(img_path, modified_path, size, crop_type='top'):
"""
Resize and crop an image to fit the specified size.
args:
img_path: path for the image to resize.