Skip to content

Instantly share code, notes, and snippets.

View sanak's full-sized avatar

Ko Nagase sanak

  • Georepublic Japan
  • Japan, Kansai
View GitHub Profile
@babatakao
babatakao / extract_fixtures.rake
Created May 13, 2012 07:47
[Ruby on Rails] Extract database to fixture yaml file.
# -*- coding: utf-8 -*-
# DBからデータを取り出してYAMLにする。生成したYAMLはtmp/fixturesに保存される
namespace :db do
namespace :fixtures do
desc "Extract database data to tmp/fixtures directory."
task :extract => :environment do
fixtures_dir = "#{Rails.root}/tmp/fixtures/"
skip_tables = ["schema_info", "schema_migrations", "sessions"]
ActiveRecord::Base.establish_connection
FileUtils.mkdir_p(fixtures_dir)
@Gab-km
Gab-km / github-flow.ja.md
Last active April 23, 2025 04:19 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@jbbarth
jbbarth / import_from_csv.rake
Created May 9, 2013 23:31
Import redmine data from CSV
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@joshbeckman
joshbeckman / animatedScrollTo.js
Created September 30, 2013 14:51
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@JamesChevalier
JamesChevalier / mac_utf8_insanity.md
Last active March 25, 2025 09:29
Unicode on Mac is insane. Mac OS X uses NFD while everything else uses NFC. This fixes that.

convmv manpage

Install convmv if you don't have it

sudo apt-get install convmv

Convert all files in a directory from NFD to NFC:

convmv -r -f utf8 -t utf8 --nfc --notest .

@parmentf
parmentf / GitCommitEmoji.md
Last active May 12, 2025 06:48
Git Commit message Emoji
@smellman
smellman / maps.me.build_memo_osx.md
Last active January 20, 2016 05:55
build memo for Maps.ME in OSX

maps.me memo

build maps.me

install depend packages

brew install boost
brew install qt5
@minorua
minorua / script.js
Created December 1, 2017 04:08
[QGIS-tr] 翻訳集計スクリプト (年別翻訳者別)
// 翻訳集計スクリプト (年別翻訳者別)
// 1. 翻訳者情報付き翻訳データを取得(ブラウザで表示)
// https://www.transifex.com/api/2/project/QGIS/resource/qgis-application/translation/ja/strings/?details&last_update&user
// 2. ブラウザのコンソールで次のスクリプトを実行
var aggr = {};
JSON.parse(document.body.innerText).forEach(function (msg) {
var year = msg.last_update.substr(0, 4);
aggr[year] = aggr[year] || {total: 0};
aggr[year][msg.user] = (aggr[year][msg.user] || 0) + 1;
@rraval
rraval / postgres-collation.md
Last active July 30, 2024 07:05
PostgreSQL collation is a massive footgun

This is a slightly stripped down version from our internal bug tracker. The point of posting this publicly is part FYI, part peer review. I'm hoping someone can look at this, disagree, and tell me all the downsides of using the C locale or point out things I've misunderstood. The Recommendations section in particular is contextualized by our database serving a SaaS product for users from many different locales, thus making locale a render level concern. YMMV, caveat emptor, etc.


Collation defines the character ordering for textual data. For Postgres, https://www.postgresql.org/docs/current/static/locale.html:

The locale settings influence the following SQL features:

  • Sort order in queries using ORDER BY or the standard comparison operators on textual data
  • The upper, lower, and initcap functions
@AsgerPetersen
AsgerPetersen / notes.md
Last active March 28, 2025 18:31
Debugging QGIS 3.x python plugins on OSX using VS Code

Debugging QGIS 3.x python plugins on OSX using VS Code

Plugin

In QGIS install the plugin debugvs.

Python dependencies

The debugvs plugin needs the python module ptvsd to function. This module is not installed by default.

In principle you just pip install ptvsd in the python interpreter used by QGIS.