Skip to content

Instantly share code, notes, and snippets.

#These are the results I found from the period of data on the MDNR site
#https://www.dnr.state.mn.us/climate/twin_cities/listings.html
#1970-01-18 max temp: -13.0 min temp: -28.0
#1970-01-19 max temp: -10.0 min temp: -34.0
#1970-01-20 max temp: -10.0 min temp: -24.0
#1970-01-21 max temp: -3.0 min temp: -29.0
#1970-02-03 max temp: -5.0 min temp: -21.0
#1971-02-07 max temp: -2.0 min temp: -20.0
#1971-02-08 max temp: 0.0 min temp: -23.0
SELECT TABLE_NAME 'Table', COLUMN_NAME 'Field', COLUMN_TYPE 'Type', IS_NULLABLE 'Null',
COLUMN_KEY 'Key', COLUMN_DEFAULT 'Default', EXTRA 'Extra' FROM information_schema.columns WHERE
table_schema = 'yourdb' ORDER BY TABLE_NAME;
ef save_payment
form_params = params.permit(
:stripeToken,
).deep_stringify_keys
# # Create a Stripe Customer:
customer = nil
begin
customer = Stripe::Customer.create(
<% unless current_user.stripe_charge_id_opencall_2017.blank? %>
<div class="ui green message"> The provided card has been charged. </div>
<% else %>
<div class="ui grid">
<div class="twelve wide column">
<h4>You will only be charged once.</h4>
<p>Payment processing occurs offsite via Stripe payments. Your credit information is not stored on this site.</p>
</div>
@nateflink
nateflink / ruby
Created June 27, 2018 03:26
pad dollars
val = "32.244"
if val.is_a? String
if val.match /\d+\.\d\d$/
val
elsif val.match /(\d+\.\d\d)\d+$/
$1
elsif val.match /\d+\.\d$/
val+'0'
elsif val.match /\d+\.$/
val+'00'
<?php
$xml_post_string =
'<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.edocbuilder.com/">
<SOAP-ENV:Body>
<ns1:getOrderFile>
<ns1:docSessionID>replace-with-real-a49a-3862345df1061</ns1:docSessionID>
<ns1:email>EMAIL</ns1:email>
<ns1:password>PASSWORD</ns1:password>
</ns1:getOrderFile>
@nateflink
nateflink / gist:f3652012615117488c47
Created May 5, 2015 21:58
Bash Alias Made Easy
#alias to reload the bash profile after adding an alias
alias sourcebash="source ~/.bash_profile"
#alias to quickly add an alias to the bash profile
alias aliasappend=aliasappendfunction
aliasappendfunction() {
echo 'alias '$1'="'$2'"' >> ~/.bash_profile;
sourcebash
}
@nateflink
nateflink / gist:9f49dbe3f2efb7b6b51d
Created March 18, 2015 00:32
JS function to determine if two strings are anagrams
function check_anagrams(first_words, second_words) {
if (first_words.length != second_words.length) {
console.log(0);
return;
}
var letters=[], is_anagram, first_word, second_word, exists;
for (var i=0; i<first_words.length; i++) {
[
//
// TABS (REGULAR)
//
// Tab set
{
"class": "tabset_control",
"layer0.texture": "",
@nateflink
nateflink / gist:946aa10d3872ba896ea9
Last active August 29, 2015 14:04
MYSQL create db
CREATE USER 'foobaz'@'%' IDENTIFIED BY 'foopassword';
CREATE DATABASE IF NOT EXISTS `foobaz` ;
GRANT ALL PRIVILEGES ON foobaz.* TO foobaz@localhost IDENTIFIED BY 'foopassword';
;superuser
CREATE USER 'user'@'%' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';