Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
nishinoshake / getUnixTime.js
Created December 8, 2016 07:00
Unix時間の取得
getUnixTime: function(){
return (new Date()).getTime();
}
@nishinoshake
nishinoshake / slack.sh
Created November 29, 2016 06:26
シェルからSlack
curl -s -S -X POST --data-urlencode "payload={\"text\":\"domain changed\"}" 'https://hooks.slack.com/services/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' > /dev/null
@nishinoshake
nishinoshake / .htaccess
Created November 29, 2016 03:58
.htaccessでSSLを強制
RewriteEngine On
# Redirect If Not Secure
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
@nishinoshake
nishinoshake / memory.sh
Created November 25, 2016 10:42
メモリ使用量を確認する
ps aux | grep httpd | awk '{sum += $6}END{print sum/1000}'
@nishinoshake
nishinoshake / index.sass
Last active January 8, 2017 07:30
CSS Style Guide
// ==========================================================================
// Foundation
// ==========================================================================
@import "foundation/_variables"
@import "foundation/_reset"
@import "foundation/_base"
// ==========================================================================
// Component
// ==========================================================================
@nishinoshake
nishinoshake / transitionend.js
Created November 10, 2016 11:06
transitionendのJS
/**
* transitionEndのイベント
*
* 使えない場合はsetTimeout
*/
$.fn.extend({
transitionEnd: function() {
var style = document.createElement('div').style;
var canUse = "transition" in style || "WebkitTransition" in style;
var defer = new $.Deferred();
@nishinoshake
nishinoshake / .htaccess
Created November 7, 2016 05:41
.htaccessでファイルアクセス制限
# https://httpd.apache.org/docs/current/ja/mod/core.html#files
# ~ で正規表現が使える
<Files ~ "\.json">
Order Deny,Allow
Deny from All
</Files>
@nishinoshake
nishinoshake / goutte.php
Created November 5, 2016 11:47
PHPでスクレイピング
// Goutte is good
//
// https://github.com/FriendsOfPHP/Goutte
//
// * install *
// composer require fabpot/goutte
use Goutte\Client;
$client = new Client();
@nishinoshake
nishinoshake / component.js
Created November 4, 2016 16:14
React Stateless Functional Component
const App = () => {
return (
<div>
<h2>hoge</h2>
</div>
)
}
@nishinoshake
nishinoshake / reset.sql
Created October 23, 2016 17:12
AUTO_INCREMENTのリセット
ALTER TABLE tablename AUTO_INCREMENT = 1;