Skip to content

Instantly share code, notes, and snippets.

Avatar

onozaty onozaty

View GitHub Profile
View clipboard.js
var copyUrl = (e) => {
e.clipboardData.setData('text/plain', document.title + ' ' + location.href);
e.preventDefault();
document.removeEventListener('copy', copyUrl);
}
document.addEventListener('copy', copyUrl);
document.execCommand('copy');
@onozaty
onozaty / MeatMenu.java
Last active Jul 17, 2018
2018-07-11 リファクタリング
View MeatMenu.java
package com.example;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
public class MeatMenu {
private final List<Menu> allMenus;
@onozaty
onozaty / Score.java
Last active Jul 15, 2018
2018-05-16 リファクタリング
View Score.java
package com.example;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
public class MeatMenu {
private final List<Menu> allMenus;
View FileReadExample.java
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
View application_helper.rb.diff
--- application_helper.rb.org 2015-10-27 16:40:44.965296050 +0000
+++ application_helper.rb 2015-10-28 15:16:58.451497039 +0000
@@ -739,7 +739,7 @@
# identifier:version:1.0.0
# identifier:source:some/file
def parse_redmine_links(text, default_project, obj, attr, only_path, options)
- text.gsub!(%r{<a( [^>]+?)?>(.*?)</a>|([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-_]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m|
+ text.gsub!(%r{<a( [^>]+?)?>(.*?)</a>|([\s\(,\-\[\>]|[^\x00-\x7F]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-_]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|[^\x00-\x7F]|$)}) do |m|
tag_content, leading, esc, project_prefix, project_identifier, prefix, repo_pre
@onozaty
onozaty / gist:d055aac1b16ac234c738
Created Oct 24, 2015
suggest.jsで2文字以上の入力で補完を始めるサンプル
View gist:d055aac1b16ac234c738
// 補完候補の配列作成
var list = ['Java', 'JavaScript', 'Perl', 'Ruby', 'PHP', 'Python', 'C', 'C++', '.NET', 'MySQL', 'Oracle', 'PostgreSQL'];
var startup = function(){
new Suggest.Local(
'text',
'suggest',
list,
{
getInputText: function() {
@onozaty
onozaty / .js
Last active Aug 29, 2015
Grouping assign user selectbox (Redmine view customize plugin)
View .js
// Path pattern: /issues
// Type : JavaScript
$(function() {
if ($('#issue_assigned_to_id').length == 0) {
return;
}
function rebuildUserSelectbox(selectbox) {
View gist:1137e4edc0a55078fd1f
// Path pattern: /issues
// Type : JavaScript
$(function() {
$('table.list.issues a.parent').each(function() {
if (!this.nextSibling) return;
this.title = this.nextSibling.textContent.substr(2);
this.nextSibling.parentNode.removeChild(this.nextSibling);
});
@onozaty
onozaty / gist:2257fb7e153bd582088d
Created May 25, 2015
Change project list page(Redmine view customize plugin)
View gist:2257fb7e153bd582088d
// Path pattern: /projects/?$
// Type : JavaScript
$(function() {
var root = $('#projects-index').children('.projects').children('li');
var rows = [];
for (var i = 0, len = root.length; i < len; i++) {
@onozaty
onozaty / gist:a684d5e8087f03bc20c6
Created Apr 21, 2015
Better checkbox field by Redmine view customize plugin
View gist:a684d5e8087f03bc20c6
// Path pattern: /issues/
// Type : JavaScript
$(function() {
$('.check_box_group')
.each(function() {
var checkBoxGroup = $(this);
checkBoxGroup.hide();
var checkedValueLine =
You can’t perform that action at this time.