Skip to content
View frequencies.cpp
#include <QDebug>
int main(int argc, char** argv) {
// Original sentence
QString const sentence = "this test of is a a this test phrase of is a of a of a test";
qDebug() << "\nTest sentence for histogram is:\n\t" << sentence << "\n\n";
// Split the sentence
QStringList const words = sentence.split(" ");
View CMakeLists.txt
cmake_minimum_required(VERSION 3.2)
project(etl)
set(CMAKE_PREFIX_PATH "/usr/local/Cellar/qt5/5.5.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindTBB/")
View gist:bc4e1c5c881029a9f7c4
URL endpoint: https://www.doap.jp/api/SBrand/TransactionReception.php?branchNo=demo3001
Method: POST
Headers:
Content-Type: application/json
Body:
{
"data":
[
{
"postal_code": "854-0044",
View gist:56228e0f4b86a1a115d6
class FixedPrecisionDecimal
{
const int number; // 1234.5678
FixedPrecisionDecimal(float)
{
}
FixedPrecisionDecimal(double)
{
View gist:f85198ca6dd850a2b1be
func Kermit(byteArray []byte) uint16 {
var crc uint16
for i := 0; i < len(byteArray); i++ {
b := uint16(byteArray[i])
q := (crc ^ b) & 0x0f
crc = (crc >> 4) ^ (q * 0x1081)
q = (crc ^ (b >> 4)) & 0xf
crc = (crc >> 4) ^ (q * 0x1081)
}
return (crc >> 8) ^ (crc << 8)
View gist:d865de5afdbd91c477cf
$('.checkrate').click(function (e) {
e.preventDefault();
var fromObj = fromPicker.get('select');
var toObj = toPicker.get('select');
hhotelDispopriceFHP('ASIATHBKHTLATSiam', '', '', fromObj.year, fromObj.month + 1, fromObj.date, (toObj.obj - fromObj.obj) / (1000 * 60 * 60 * 24), $('#adults').val(), $('#children').val(), $('#accesscode').val(), 'THB')
});
View gist:17e8dd8ee421e74b1197
from_date = Date.new(2015, 02, 1)
to_date = Date.civil(2015, 02, -1)
attendance_lines_by_date = File.open(ATTENDANCE_LINES_FILE)
.readlines
.map { |line_text| AttendanceLine.new line_text, ROSTER }
.select { |line| line.date >= from_date and line.date <= to_date }
.reject { |line| line.date.weekend? }
.group_by { |line| line.date }
View why_i_<3.rb
require 'csv'
module Roster
# Example of each row is: [1,Pac,Sivabudh Umpudh,nil,nil,nil,nil,nil,nil]
def self.parse_from_csv filename
CSV.read(filename)
.drop(1) # remove the first row of CSV which is a header
.map(&:compact) # remove all `nil`
.map { |line_array| [line_array[0], "#{line_array[1]} - #{line_array[2]}"] } # convert ["1", "Pac", "Sivabudh Umpudh"] to ["1", "Pac - Sivabudh Umpudh"]
.to_h # convert array to hash: voila, I now got a hash with key as the ID, and value as my name!
View imperative_vs_functional.rb
puts "Hello. Welcome to the Functional World!"
#
# This is how to do it imperative style (aka: Stupid Java programmer)
#
array = [1,2,3,4]
new_array = []
array.each do |n|
if n % 2 == 0
new_array.push n
View functional_vs_imperative
puts "Hello. Welcome to the Functional World!"
# This is how to do it imperative style (Stupid Java programmer)
array = [1,2,3,4]
new_array = []
array.each do |n|
if n % 2 == 0
new_array.push n
end
Something went wrong with that request. Please try again.