Skip to content

Instantly share code, notes, and snippets.

View yujiym's full-sized avatar
💭

Yuji Yamaguchi yujiym

💭
View GitHub Profile
@ww9
ww9 / gist_blog.md
Last active April 23, 2025 12:56
Using Gist as a blog #blog

Blogging with Gist

Gist simplicity can turn blogging into a liberating experience.

Pros Cons
✅ Free, simple, fast, hassle-free ❌ Image upload in comments only
✅ Tagging ❌ No post pinning
✅ Search ❌ Doesn't look like a blog
✅ Revisions ❌ Unfriendly URLs
@SagiMedina
SagiMedina / ImageTools.js
Last active September 7, 2024 04:39
Resize and crop images in the Browser with orientation fix using exif
import EXIF from 'exif-js';
const hasBlobConstructor = typeof (Blob) !== 'undefined' && (function checkBlobConstructor() {
try {
return Boolean(new Blob());
} catch (error) {
return false;
}
}());
@stephensauceda
stephensauceda / gulpfile.babel.js
Created June 11, 2015 23:45
ES6 Gulpfile Example
/*
* Steps
* 1. Rename your gulpfile.js to gulpfile.babel.js
* 2. Add babel to your package.json (npm install -D babel)
* 3. Start writing ES6 in your gulpfile!
*/
import gulp from 'gulp'; // ES6 imports!
import sass from 'gulp-sass';
@onk
onk / .rubocop.yml
Last active January 15, 2018 02:30
僕の使っている .rubocop.yml
# rubocop v0.35.0 から inherit_gem という機能が増えたので gem にしました
# https://github.com/onk/onkcop
inherit_gem:
onkcop: "config/rubocop.yml"
test:
pre:
- "export PULL_REQUEST_ID=`bundle exec prid willnet/savanna` && if [ $PULL_REQUEST_ID ]; then cd .. && git clone [email protected]:willnet/savanna.git for_pronto && cd for_pronto && git checkout -b ${CIRCLE_BRANCH} remotes/origin/${CIRCLE_BRANCH} && bundle install && PULL_REQUEST_ID=`bundle exec prid willnet/savanna` bundle exec pronto run -c master -f github_pr && cd ../savanna; else echo 'current branch is not pull request'; fi"
@gaearon
gaearon / ClassNameMixin.js
Last active March 23, 2018 17:18
BEM in React
'use strict';
var React = require('react'),
classSet = require('react/lib/cx'),
_ = require('underscore');
var ClassNameMixin = {
propTypes: {
className: React.PropTypes.string,
context: React.PropTypes.string
@tarjei
tarjei / Modal.jsx
Created June 17, 2014 11:02
Foundation.reveal as a React.js component
/**
* @jsx React.DOM
*/
var React = require('react/addons');
/* the link component is used to navigate away from th current url. Some of it is app spesific and
therefore not included here. */
var Link = require('../components/Link.jsx');
var cx = React.addons.classSet;
//gulp & plugins
var gulp = require('gulp');
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var browserify = require('gulp-browserify');
var jade = require('gulp-jade');
var stylus = require('gulp-stylus');
var mocha = require('gulp-mocha');
var nodemon = require('gulp-nodemon');
var livereload = require('gulp-livereload');

How To Serve Multiple Ghost Blogs on One VPS

1個のVPSで複数のGhostを立ち上げる方法。といっても、下に書いてあるとおりなんですが…w

How To Serve Multiple Ghost Blogs on One VPS Using Nginx Server Blocks | DigitalOcean

Digital Oceanは、Ghostの入ったドロップレットが用意されているので、セットアップでそれを選べば1分でサイトは用意できます。Ghost側のconfig.jsとかちょいちょいっと修正すればあっという間に完成です。

でも、今のバージョンのGhostは1インストールで複数のブログを設置することができないので、複数のサイトを立ち上げたい時はサブドメインとかで分けてそれぞれを起動する必要があります。Digital OceanのGhostのドロップレットは「Ubuntu+nginx」なので、最初に任意のホストを登録した後に(Ghost動かしてからでもいいけど)nginxの設定を2つ分けてあげればオッケー。

@gonzalo-bulnes
gonzalo-bulnes / XXXXXXXXXXXXX_add_authentication_token_to_users.rb
Last active March 6, 2019 15:15
(Update: I've packaged this gist into a gem to make its use easier, see: https://github.com/gonzalo-bulnes/simple_token_authentication.) Add token authentication to your Rails API. Follows the José Valim recomendations and is fully compatible with Devise (tokens are created the first time users sign in). See https://gist.github.com/josevalim/fb7…
# db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb
class AddAuthenticationTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :authentication_token, :string
add_index :users, :authentication_token, :unique => true
end
end