Skip to content

Instantly share code, notes, and snippets.

View negabaro's full-sized avatar

kim negabaro

View GitHub Profile
@colynn
colynn / _config.yml
Last active August 14, 2020 05:12
add gitalk-comment/ utterances support for jekyll
# To use Gittalk comments https://github.com/gitalk/gitalk#Usage
# jekyll synatx: https://jekyllrb.com/docs/liquid/
gittalk:
# Note: A GitHub Application is needed for authorization, if you don't have one, going to https://github.com/settings/applications/new register a new one.
# You must specify the website domain url in the Authorization callback URL field.
clientID: # GitHub Application Client ID
clientSecret: # GitHub Application Client Secret,
repository: blog-comments # Storage gittalk's repository
owner: colynn # GitHub repo owner,
admin: colynn # GitHub repo owner and collaborators, only these guys can initialize github issues eg. 'colynn,daattali'
@zerowebcorp
zerowebcorp / docker-swarm-auto-rebalance.sh
Created December 10, 2017 17:08
Docker Swarm automatically rebalance when new worker node joins
FILE=/tmp/worker.nodes
touch ${FILE} || exit
for node in `docker node ls --filter role=worker -q`; do
if grep -Fxq "${node}" ${FILE}
then
echo "This node ${node} already exists"
else
echo "This node ${node} joined recently, so rebalance"
for service in `docker service ls -q`; do
@remy
remy / .eslintignore
Last active April 13, 2021 04:48
My Next.js eslint config + `npm install --save-dev eslint eslint-plugin-react babel-eslint`
.next
out
@negabaro
negabaro / rails-controller.txt
Last active September 19, 2017 14:02
CRUD simple noticeboard with rails5.1
app/controller/articles_controller.rb
class ArticlesController < ApplicationController
before_action :set_article, only: [:show, :edit, :update, :destroy]
def show
end
def edit

If you have problems when downloading large results sets from reDash it may be you are running against the default 30 seconds timeout in gunicorn. To solve this you can edit your:

/opt/redash/supervisord/supervisord.conf

and change:

[program:redash_server]
command=/opt/redash/current/bin/run gunicorn -b 127.0.0.1:5000 --name redash -w 4 redash.wsgi:app
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@andfaulkner
andfaulkner / externals-webpack.config.js
Last active April 4, 2024 12:43
Split Webpack configuration into modules by functionality (rather than environment)
const prodExternals = {
'react': 'React',
'react-dom': 'ReactDOM',
'lodash': '_',
'redux': 'Redux',
'react-redux': 'ReactRedux',
'react-bootstrap': 'ReactBootstrap'
};
const testExternals = {
@jobbin
jobbin / signup.html
Last active June 7, 2017 02:22
[ Serverless ] Cognito、S3、Lambdaで認証機能付きのWebサイトを作ってみました ref: http://qiita.com/jobbin/items/d2fc0f714eb1f1cfc965
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>Sign Up</title>
<!-- aws sdk //-->
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.3.8.min.js"></script>
<!-- aws cognito sdk(beta)と必要なライブラリ //-->
<script src="***/jsbn.js"></script>
@nashirox
nashirox / rails-validates.rb
Last active May 31, 2024 04:11
Rubyのバリデーション用正規表現集
#
# 数字
#
# 全て数値(全角)
/\A[0-9]+\z/
# 全て数値(半角)
/\A[0-9]+\z/
@tamonoki
tamonoki / commandline
Last active April 23, 2020 04:05
scrapy を用いてデータを収集し、mongoDB に投入する ref: http://qiita.com/tamonoki/items/ce58ff209f8eae808162
$ scrapy crawl WebspiderSpider