Skip to content

Instantly share code, notes, and snippets.

View sassy's full-sized avatar
😀
happy hacking!

Satoshi Watanabe sassy

😀
happy hacking!
View GitHub Profile
@sassy
sassy / index.js
Created July 1, 2014 14:45
cordovaのjasmineテスト (プロジェクト作成時/jasmine1.2.0)
describe('app', function() {
describe('initialize', function() {
it('should bind deviceready', function() {
runs(function() {
spyOn(app, 'onDeviceReady');
app.initialize();
helper.trigger(window.document, 'deviceready');
});
waitsFor(function() {
#include <sys/types.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <malloc.h>
int main(void)
{
DIR *dir = opendir(".");
<html>
<head>
<script type="text/javascript">
function func() {
var ret = document.getElementById("ret");
var src_path = document.convert_form.src.value;
if (!src_path.match(/^\\\\*/)) {
ret.innerHTML = "入力する文字列が違います。"
return;
}
@sassy
sassy / 1-1.cpp
Last active January 3, 2016 16:38
CRACKING THE CODING INTERVIEW 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*
only ASCII.
*/
int
main(int argc, char **argv)
@sassy
sassy / gist:7156366
Created October 25, 2013 15:17
Snap.svgをいじってみた
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../dist/snap.svg.js"></script>
</head>
<body>
<script>
var s = Snap(600, 600);
s.circle(150, 150, 100).attr({
@sassy
sassy / gist:6820291
Created October 4, 2013 02:54
シェルのwhile文
#!/bin/sh
a=0
b=";"
while [ $a -ne 3000 ]
do
echo $a$b >> test.txt
a=`expr $a + 1`
done
@sassy
sassy / outline.html
Created September 11, 2013 14:46
これをWebKit系ブラウザ(Safari/Google Chrome)で読み込ませて、hoverして外すと、枠が一部残る。
<html>
<head>
<style>
.test:hover {
outline: solid 4px #ff0000;
outline-offset : -1px;
}
</style>
</head>
<body>
@sassy
sassy / followers.user.js
Created September 3, 2013 16:21
フォロワー数なんか手入力なんだから、もう自分で書き換えちゃえばいいじゃない。
// ==UserScript==
// @name followers
// @match https://twitter.com/*
// ==/UserScript==
(function(){
var as = document.getElementsByTagName("a");
for (var i = 0; i < as.length; i++) {
if (as[i].getAttribute("data-element-term") == "follower_stats") {
as[i].firstChild.firstChild.nodeValue = "999999";
<svg xmlns="http://www.w3.org/2000/svg" onload="func(evt)">
<script>
function func(evt) {
var ns = "http://www.w3.org/2000/svg";
var doc = evt.target.ownerDocument;
var circle = doc.createElementNS(ns, 'circle');
circle.setAttributeNS(null, 'cx', '100');
circle.setAttributeNS(null, 'cy', '100');
circle.setAttributeNS(null, 'r', '50');
doc.documentElement.appendChild(circle);
@sassy
sassy / gist:5945678
Created July 8, 2013 01:40
DailyMotionから動画を取得して、再生する。
<html>
<head>
<script src="http://api.dmcdn.net/all.js"></script>
<script type="text/javascript">
var videoArray = new Array();
var j = 0;
window.dmAsyncInit = function() {
DM.api('/videos', {search: "momoclo"}, function(response) {
console.log(response.list[0]);