Skip to content

Instantly share code, notes, and snippets.

Mufid mufid

Block or report user

Report or block mufid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ReadAllLines.java
class ReadFile {
void readFile(String fileName) {
Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8);
}
}
View ShowText.cs
mainTextFrame.Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"
View yarv-array-ruby231.txt
[1] pry(main)> require 'pp'
=> false
[2] pry(main)> pp RubyVM::InstructionSequence.compile('["aku", "suka", "ini"]').to_a
["YARVInstructionSequence/SimpleDataFormat",
2,
3,
1,
{:arg_size=>0, :local_size=>0, :stack_max=>3},
"<compiled>",
"<compiled>",
@mufid
mufid / pg.rb
Created Feb 15, 2017
Rails Nested Query
View pg.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '>= 5.0.1'
@mufid
mufid / autoconv.rb
Created Mar 31, 2016
Convert all file in the directory to *.FLAC
View autoconv.rb
target = ARGV.last
puts "Will process: #{target}"
class Fixnum
def mb
self * 1024 * 1024
end
def to_mb
self / 1024 / 1024
@mufid
mufid / g_rbt_asia_fetcher.rb
Created Jul 20, 2015
g_rbt_asia_fetcher.rb
View g_rbt_asia_fetcher.rb
class GRbtAsia < Fetcher
BASE_URL = "https://rbt.asia/g"
PAGE_TEMPLATE = "https://rbt.asia/g/g?task=page&page=%{page}"
THREAD_TEMPLATE = "https://rbt.asia/g/thread/%{thread}"
def fetch_page page_num
puts "Start fetch page #{page_num}"
html = RestClient.get(PAGE_TEMPLATE % {page: page_num})
doc = Nokogiri::HTML(html)
@mufid
mufid / gist:c92b876d28437400597a
Created May 7, 2015
ruby-descriptive-statistics-sample.rb
View gist:c92b876d28437400597a
#!/usr/bin/env ruby
require "rubygems"
require 'descriptive_statistics'
arr = []
ARGF.each_with_index do |line, idx|
# print ARGF.filename, ":", idx, ";", line
arr << line.to_i if line.to_i > 0
View funwithnpe.md

Having Fun with Java's Null

So lately i have been diving really deep (or not really) into Java. I found Java's null is interesting. I think, i hate NullPointerException very much. And most of the time, i hate my own way to deal with those things.

Btw, if you hate compiling Java's code just to test a one-line command, you may use [JavaRepl], which will give you an interactive mode of Java compiler.

String Concatenation

This is interesting. If you run

@mufid
mufid / README.md
Created Dec 4, 2014
Homakov's No-captcha Recaptcha Clickjacking
View README.md
You can’t perform that action at this time.