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
@cdesch
cdesch / Rubminecrashlog
Created March 13, 2018 17:40
rubymine crash log 3/13/2018
Process: rubymine [30235]
Path: /Applications/RubyMine.app/Contents/MacOS/rubymine
Identifier: com.jetbrains.rubymine
Version: 2017.3.3 (RM-173.4548.40)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: rubymine [30235]
User ID: 501
Date/Time: 2018-03-13 13:37:48.696 -0400
@cdesch
cdesch / pgbench
Created March 19, 2018 11:58
pg bench and timescale db
L
9.5.10
listen_addresses = 'localhost'
listen_addresses = '*'
max_connections = 100
max_connections = 200
shared_buffers = 128MB
shared_buffers = 16GB
Vector<int> my_array = new Vector<int>;
my_array.add(1);
my_array.add(2);
for (int i = 0; i < my_array.length(); i++){
}
foreach(int i in my_array) {
@cdesch
cdesch / SQL SAmple Data insert
Created March 19, 2018 12:01
timescale Timeseries example
Sample Data SQL Insert
CREATE TABLE time_series (
id SERIAL UNIQUE,
name TEXT,
timestamp TIMESTAMPTZ
);
INSERT into time_series (name,timestamp) VALUES ('Test','2018-02-13T01:18:00');
INSERT into time_series (name,timestamp) VALUES ('Test','2018-02-13T01:22:00');
2018-01-07
aws s3 cp p2pstate.bin s3://digitalnotewallet/2018-01-07/p2pstate.bin
aws s3 cp blockchainindices.dat s3://digitalnotewallet/2018-01-07/blockchainindices.dat
aws s3 cp blockindexes.dat s3://digitalnotewallet/2018-01-07/blockindexes.dat
aws s3 cp blocks.dat s3://digitalnotewallet/2018-01-07/blocks.dat
aws s3 cp blockscache.dat s3://digitalnotewallet/2018-01-07/blockscache.dat
{
"files.autoSave": "onFocusChange",
"editor.tabSize": 2,
"workbench.colorTheme": "Solarized Dark",
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"editor.rulers": [
80
],
"ruby.lint": {
require 'rubygems'
require 'mechanize'
require 'uri'
require 'csv'
#this script looks up vendors from a seed file and creates a new seed file with the domain
# using the first google search result returned
def get_host_without_www(url)
uri = URI.parse(url)
uri = URI.parse("http://#{url}") if uri.scheme.nil?
https://github.com/plataformatec/simple_form/pull/531
<%= f.input :field, :wrapper_html => {class: "input-prepend input-append"} do %>
<span class="add-on">$</span>
<%= f.input_field :field %>
<span class="add-on">%</span>
<% end %>
@cdesch
cdesch / numeric.rb
Created August 17, 2018 14:05
Rails Numeric
def is_numeric?(obj)
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
end
def is_not_numeric?(obj)
!is_numeric?(obj)
end
@cdesch
cdesch / errorHandlerEx.js
Created October 6, 2019 15:42
ReactNative ErrorHandling Example - From Expo.io
const defaultHandler = (ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler()) || ErrorUtils._globalHandler;
const customErrorHandler = async (err, isFatal) => {
await AsyncStorage.setItem('lastError', JSON.stringify(err, Object.getOwnPropertyNames(err)));
return defaultHandler(err, isFatal);
};
ErrorUtils.setGlobalHandler(customErrorHandler);
//inside the App component:
async componentWillMount() {