Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yuki24's full-sized avatar
🔢
NaN :trollface:

Yuki Nishijima yuki24

🔢
NaN :trollface:
View GitHub Profile
@zephraph
zephraph / clean_node_modules.sh
Last active June 13, 2023 13:53
A shell script to clean up all node_modules in projects that haven't been touched in a couple weeks.
#!/bin/bash
DAYS_SINCE_LAST_CHANGE=14 # If a project hasn't been touched in this long its node_modules will be deleted
SEARCH_PATH="./Git" # Update this to the path where your code is stored
TOTAL_BYTES_REMOVED=0
Mb=1000000
Kb=1000
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)
@printercu
printercu / rails-5.0-integration-tests-speedup.md
Last active March 7, 2022 01:20
Speed up Rails 5 integration tests

Speed up integration tests in Rails 5 app

Rails 5 recompiles templates on every request in test env. Fix will be released only in 5.0.2.

Add this lines to test helper to get the performance now (I've got x2 improvement):

class << ActionView::LookupContext::DetailsKey
 def clear
+----------------------+--------+--------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers | 48726 | 39215 | 522 | 3970 | 7 | 7 |
| Helpers | 14795 | 12125 | 15 | 1399 | 93 | 6 |
| Models | 96678 | 76140 | 1747 | 8548 | 4 | 6 |
| Mailers | 2208 | 1766 | 44 | 206 | 4 | 6 |
| Workers | 639 | 540 | 20 | 31 | 1 | 15 |
| Chanko units | 11713 | 9644 | 6 | 247 | 41 | 37 |
| Libraries | 50409 | 41650 | 592 | 3741 | 6 | 9 |
@keijiro
keijiro / test.md
Last active August 29, 2015 14:09

GitHubギッハブ Flavoredフレイヴァード Markdownマークダウン においては ruby タグを用もちいる事ことで漢かん字じに紅ル玉ビを振ふる事ことが可能なできるのだッッ!!!

@dutc
dutc / Makefile
Last active August 29, 2015 14:08
Did you mean? in Python (Bonus Round!)
CC=gcc -std=c99 -Wall
didyoumean.so: didyoumean.c didyoumean-safe.c
${CC} `python-config --cflags` `python-config --includes` -Wl,--export-dynamic -fPIC -shared -o $@ $^ -ldl `python-config --libs`
@dutc
dutc / didyoumean-excepthook.py
Created October 23, 2014 16:24
Did you mean? in Python
#!/usr/bin/env python
from re import search
from itertools import chain
# levenshtein
def distance(x, y):
if not len(x): return len(y)
if not len(y): return len(x)
return min(distance(x[1:], y[1:]) + (x[0] != y[0]), distance(x[1:], y) + 1, distance(x, y[1:]) + 1)

Your Rails Config

config.i18n.railties_load_path

no docs for i18n.railties_load_path found in rails guides

["/Users/schneems/.gem/ruby/2.1.2/gems/will_paginate-3.0.4/lib/will_paginate/locale/en.yml", "/Users/schneems/.gem/ruby/2.1.2/gems/devise-3.2.4/config/locales/en.yml", "/Users/schneems/Documents/projects/codetriage/config/locales/devise.en.yml", "/Users/schneems/Documents/projects/codetriage/config/locales/en.yml"]
@jbrechtel
jbrechtel / project.scala
Created May 6, 2012 17:32
Scala Android project with Proguard and ActionBarSherlock
import scala.xml.{Node => XmlNode}
import scala.xml._
import java.io.FileWriter
import sbt._
import Keys._
import AndroidKeys._
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@durran
durran / moped.txt
Created February 16, 2012 10:59
First run perf numbers, Moped.
##################################################################
# ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
# 10gen: mongo-1.5.2
# bson-1.5.2 (BSON::BSON_C)
##################################################################
user system total real
10gen: insert 10,000 blank documents 0.670000 0.060000 0.730000 ( 0.744400)
10gen: insert 10,000 blank documents safe mode 1.200000 0.140000 1.340000 ( 1.800714)
10gen: insert 1,000 normal documents 0.090000 0.010000 0.100000 ( 0.091035)