Skip to content

Instantly share code, notes, and snippets.

View cdesch's full-sized avatar
🏠
Working from home

cdesch cdesch

🏠
Working from home
View GitHub Profile
defmodule AdLock.DataProcessTest do
@timeout 60000
def start do
#list of files
# files = ["/Volumes/Backup/samples/raw-000000000000.csv.gz",
# "/Volumes/Backup/samples/raw-000000000001.csv.gz"]
#files = ["/Volumes/Backup/samples/raw-000000000000.csv.gz"]
#files = ["/Volumes/Backup/samples/raw-000000000000.csv"]
files = ["/Users/cj/Downloads/raw-1-small.csv.gz",
@cdesch
cdesch / gist:867d8d9a8aa2ae78af64f1d179fec89d
Last active March 10, 2019 11:03
elixir regex Cheat sheet
iex(1)> s1 = "Hello, World!"
"Hello, World!"
iex(2)> s2 = "ボリスくん"
"ボリスくん"
iex(3)> Regex.scan(~r/\S/, s1)
[["H"], ["e"], ["l"], ["l"], ["o"], [","], ["W"], ["o"], ["r"], ["l"], ["d"],
["!"]]
iex(4)> Regex.scan(~r/\S/, s2)
[[<<227>>], [<<131>>], [<<156>>], [<<227>>], [<<131>>], [<<170>>], [<<227>>],
[<<130>>], [<<185>>], [<<227>>], [<<129>>], [<<143>>], [<<227>>], [<<130>>],
@cdesch
cdesch / interfaces
Created September 25, 2017 19:37
Network Interfaces Config
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
@cdesch
cdesch / rails_generator_cheat_sheet.md
Last active April 4, 2025 13:13
Rails Generator CheatSheet

Cheat Sheets are greate but they are not a substitute for learning the framework and reading the documentation as we most certainly have not covered every potential example here. Please refer to the Rails Command Line Docs for more information.

Command Line Generator Info

Reference

You can get all of this information on the command line.

rails generate with no generator name will output a list of all available generators and some information about global options. rails generate GENERATOR --help will list the options that can be passed to the specified generator.

lass CreateCaseStudies < ActiveRecord::Migration[5.1]
def change
create_table :case_studies do |t|
t.string :title
t.text :description
t.text :short_description
t.string :slug
t.text :content
t.boolean :hidden, default: false
t.datetime :published_at
@cdesch
cdesch / migration.md
Last active September 18, 2017 15:23

The migration is an easy one line fix:

class CreateCaseStudies < ActiveRecord::Migration[5.1]
  def change
    create_table :case_studies do |t|
      t.string :title
      t.text :description
      t.text :short_description
 t.string :slug
0x3DC13E32C8a6948b7C513aF9D9BEF545cD38d7D5
0x3DC13E32C8a6948b7C513aF9D9BEF545cD38d7D5
0x05514C93e8CE4183Ac968e9fac76fAF886e874AA
@cdesch
cdesch / App.cs
Last active June 12, 2017 16:43
Rollbar.NET WPF Sample
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using RollbarDotNet;
namespace Sample