Skip to content

Instantly share code, notes, and snippets.

View hekt's full-sized avatar
🗼

Kazutoshi Horie hekt

🗼
View GitHub Profile
@hekt
hekt / gist:3727949
Created September 15, 2012 13:39
YouTube Large player by default
/*
http://blog.hawn.be/2011/10/07/how-to-force-youtube-to-use-expanded-view-by-default-and-even-larger/
*/
div#watch-player.flash-player,
div#watch-player.html5-player,
div#watch-video {
width: 854px !important; height: 510px !important;
/* width: 970px !important; height: 580px !important; */
/* width: 1280px !important; height: 765px !important; */
@hekt
hekt / gist:3757203
Created September 20, 2012 17:25
local alias
alias cd="mycd"
function mycd() {
    \cd $1
    if [ $? == 0 ]; then
        restore_aliases
        if [ -e ".bashrc.local" ]; then
            save_aliases
            source .bashrc.local
        fi
    fi
@hekt
hekt / remove-rubbish.js
Last active October 11, 2015 08:58
Yahoo!ニュースのスポーツカテゴリから有害なソースを排除する
// ==UserScript==
// @name remove rubbish
// @namespace http://www.hekt.org/
// @include http://dailynews.yahoo.co.jp/fc/sports/*
// ==/UserScript==
(function() {
var rs = [
"日刊ゲンダイ",
"夕刊フジ",
@hekt
hekt / gist:3841489
Created October 5, 2012 18:20
add vendor prefixes
;; add css vendor prefixes
(defun add-css-vendor-prefixes (start end)
(interactive "r")
(replace-regexp
"\\([\s\t]*\\)\\(\\(?:.\\|\n\\)+;\\)"
"\\1-webkit-\\2\n\\1-moz-\\2\n\\1-ms-\\2\n\\1-o-\\2\n\\&"
nil start end))
(defun add-css-vendor-prefixes-to-value (start end)
(interactive "r")
(replace-regexp
@hekt
hekt / gist:4156521
Created November 27, 2012 19:42
parts of workflow that clip an item window from screenshot of borderlands (1280x800) and save it to dropbox
for f in "$@"
do
/usr/local/bin/convert -crop 486x331+647+408 "$f" "$HOME/Dropbox/Photos/Borderlands Weapons/${f##*/}"
done
@hekt
hekt / background.js
Created July 25, 2013 12:44
skip hatebu
(function() {
var urls = ['http://b.hatena.ne.jp/entry/',
'http://zenback.itmedia.co.jp/contents/',
'http://ceron.jp/url/'];
chrome.tabs.onUpdated.addListener(function(tabid, inf, tab) {
for (var i = 0; i < urls.length; i++) {
if (inf.url.indexOf(urls[i]) === 0) {
var newUrl = inf.url.replace(/^(https?:\/\/).*?\/.*?\/(.*)$/, '$1$2');
chrome.tabs.update(tabid, {"url": newUrl});
@hekt
hekt / loader.js
Created April 4, 2014 13:13
JavaScript Loader
function jsLoader() {
"use strict";
var scripts = [].slice.call(arguments);
var reserves = [];
var thisScript = document.scripts[0] || document.querySelector("script");
var head = thisScript.parentNode;
if ("async" in thisScript)
parallel();
@hekt
hekt / LotteryEntry.swift
Created November 2, 2014 13:43
lottery プロジェクト の Swift 版 (『MAC OS X COCOA プログラミング』3,4章)
import Foundation
class LotteryEntry: NSObject {
var entryDate: NSDate
var firstNumber: Int
var secondNumber: Int
init(initWithEntryDate theDate: NSDate) {
entryDate = theDate
firstNumber = random() % 100 + 1
@hekt
hekt / SpeakLineAppDelegate.swift
Created November 3, 2014 05:08
SpeakLine アプリケーションの Swift 版 (『MAC OS X COCOA プログラミング』第5章)
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
@IBOutlet weak var textField: NSTextField!
let speechSynth = NSSpeechSynthesizer(voice: nil)
@hekt
hekt / LetterCountChallengeAppDelegate.swift
Created November 3, 2014 10:10
LetterCountChallenge アプリケーションの Swift 版 (『MAC OS X COCOA プログラミング』第5章)
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
@IBOutlet weak var textField: NSTextField!
@IBOutlet weak var textLabel: NSTextField!