This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ActiveRecord::Base | |
| def self.import!(record_list) | |
| raise ArgumentError 'record_list not an Array of Hashes' unless record_list.is_a?(Array) && record_list.all? {|rec| rec.is_a? Hash } | |
| return if record_list.empty? | |
| record_list.in_groups_of(1000, false).each do |record_group| | |
| key_list, value_list = convert_record_list(record_group) | |
| sql = "INSERT INTO #{self.table_name} (#{key_list.join(', ')}) VALUES #{value_list.map {|rec| "(#{rec.join(', ')})" }.join(' ,')}" | |
| self.connection.insert_sql(sql) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| # All Vagrant configuration is done here. The most common configuration | |
| # options are documented and commented below. For a complete reference, | |
| # please see the online documentation at vagrantup.com. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Bulbasaur | |
| Ivysaur | |
| Venusaur | |
| Charmander | |
| Charmeleon | |
| Charizard | |
| Squirtle | |
| Wartortle | |
| Blastoise | |
| Caterpie |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| Dir['*.csv'].each { |f| File.rename(f, "#{f.to_i}.csv") } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TestChar { | |
| public static void main(String[] args) { | |
| long tests = 1000000000; | |
| byte b = (byte) 'b'; | |
| long start = System.nanoTime(); | |
| for (int i = 0; i < tests; i++) { | |
| String a = "" + (char) b; | |
| } | |
| System.out.println("Done: " + (System.nanoTime() - start) / 1000000000.0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TestChar { | |
| public static void main(String[] args) { | |
| long tests = 1000000000; | |
| char c = 'c'; | |
| long start = System.nanoTime(); | |
| for (int i = 0; i < tests; i++) { | |
| String a = "" + c; | |
| } | |
| System.out.println("Done: " + (System.nanoTime() - start) / 1000000000.0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| namespace :customers do | |
| desc 'Load customers and their addresses' | |
| task :load, [:path] => :environment do |t, args| | |
| headers = [:telephone, :name, :lot_no, :street_direction, :street_name, :street_subtitle, | |
| :city, :service_type, :lcp_name, :nap_name, :nap_count, :nap_size] | |
| modem_models = %w{ZNID-GPON-2424 ZNID-GPON-2425 ZNID-GPON-2426}.map { |m| { name: m } } | |
| models = ModemModel.create!(modem_models) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Modem.joins( | |
| network_access_point_port: | |
| { distribution_strand: | |
| { splitter_port: :splitter } } ).where('splitters.fiber_strand_id' => 121) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [1, 2, 3, 7, 8, 11, 12, 13].enum_for(:chunk).with_index { |x, index| x - index }.map { |diff, group| [group.first, group.last] } |