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 / gist:343ca5581e33253a4a0270a54c6950d7
Created November 16, 2019 16:34
Python Environment Cheatsheet
https://www.geeksforgeeks.org/python-virtual-environment/
$ virtualenv -p /usr/bin/python3 virtualenv_name
$ source virtualenv_name/bin/activate
This file has been truncated, but you can view the full file.
2001 silly pacote range manifest for @types/istanbul-reports@^1.1.1 fetched in 50ms
2002 silly resolveWithNewModule @types/istanbul-reports@1.1.1 checking installable status
2003 http fetch GET 304 https://registry.npmjs.org/@types%2fistanbul-lib-coverage 54ms (from cache)
2004 silly pacote version manifest for @types/istanbul-lib-coverage@2.0.1 fetched in 55ms
2005 silly resolveWithNewModule @types/istanbul-lib-coverage@2.0.1 checking installable status
2006 http fetch GET 304 https://registry.npmjs.org/@types%2fyargs 55ms (from cache)
2007 silly pacote range manifest for @types/yargs@^13.0.0 fetched in 57ms
2008 silly resolveWithNewModule @types/yargs@13.0.3 checking installable status
2009 http fetch GET 304 https://registry.npmjs.org/@types%2fistanbul-lib-report 35ms (from cache)
2010 silly pacote range manifest for @types/istanbul-lib-report@* fetched in 36ms
@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() {
@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
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 %>
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?
{
"files.autoSave": "onFocusChange",
"editor.tabSize": 2,
"workbench.colorTheme": "Solarized Dark",
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"editor.rulers": [
80
],
"ruby.lint": {
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
@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');
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) {