Skip to content

Instantly share code, notes, and snippets.

@nexpr
nexpr / RegularExpressionFragment.js
Last active August 22, 2016 06:03
make regexp object
function Ref(...args){
if(!(this instanceof Ref)) return new Ref(...args)
this.fragment = this.constructor.merge(...args)
}
Object.assign(Ref, {
_(fragment){
var ref = new this
ref.fragment = fragment
return ref
@nexpr
nexpr / Dialog.usage.cs
Created November 6, 2016 15:09
ボタンを自作できる MessageBox
private void button_Click_1(object sender, RoutedEventArgs e)
{
var selection = new Dialog().show("うぃんどうたいとる", "ああああああい\nいいいいいいいいい\nうううううううううううう\nnagaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaai-text\n123", new List<string>
{
"ボタン01", "ボタン02", "ボタン03",
"ボタン04", "ポタン05", "ボタン06",
"ボタン07", "ボタン08", "ボタン09",
"ボタン10", "ボタン11", "ボタン12",
});
Console.WriteLine(selection);
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace liblib
{
class MutableAnonymousObject : DynamicObject
@nexpr
nexpr / getDirectoryTree.js
Created November 13, 2016 12:21
nodejs get directory tree
function getDirectoryTree(start_dirpath, {dir = true, file = true, max_depth = -1, flatten = false} = {}){
const tree = {}
dir = !!dir
file = !!file
max_depth = ~~max_depth
flatten = !!flatten
!function recur(dirpath, store, depth){
if(depth > max_depth && max_depth >= 0) return
@nexpr
nexpr / DropSupporter.css
Created November 13, 2016 18:04
fullscreen drop supporter
body{
margin: 0;
}
.droparea{
all: initial;
position: fixed;
z-index: 1000;
width: 100%;
height: 100%;
box-sizing: border-box;
@nexpr
nexpr / EvalExtension.cs
Created November 14, 2016 08:19
private もアクセスできる reflection eval
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
namespace liblib
{
public static class EvalExtension
@nexpr
nexpr / TextBoxDataList.xaml.cs
Last active December 6, 2016 11:41
textbox-datalist (auto complete)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
@nexpr
nexpr / AutoValidateTarget.cs
Last active December 5, 2016 03:51
BindingDataBase (WPF ViewModel Base)
using System;
namespace liblib.wpf
{
[AttributeUsage(AttributeTargets.Property)]
public class AutoValidateTarget : Attribute
{
}
}
@nexpr
nexpr / functons1612.php
Last active December 30, 2016 15:26
startsWith, endsWith, joinByKey, filterByKey, reduceByEntry
<?php
function startsWith($str, $substr){
return (bool)preg_match("/^{$substr}/", $str);
}
function endsWith($str, $substr){
return (bool)preg_match("/{$substr}$/", $str);
}
@nexpr
nexpr / ReflectionExtension.cs
Last active January 5, 2017 14:27
reflection helper
using System;
using System.Reflection;
namespace liblib
{
public static class ReflectionExtension
{
/// <summary>
/// ReflectionExtension でのエラー
/// </summary>