Skip to content

Instantly share code, notes, and snippets.

View danmo91's full-sized avatar

Dan Morain danmo91

View GitHub Profile
-- set output to csv
.output me_to_andy.csv
-- query (date, text) from me to andy
-- you need to find out which handle_id is relevant to your query
select datetime(date_delivered + strftime('%s', '2001-01-01 00:00:00'), 'unixepoch', 'localtime') as date, text from message where handle_id = 175 AND is_from_me = 1;
-- set output to terminal stdout
.output stdout
@danmo91
danmo91 / code-1.htm
Created April 19, 2016 19:11 — forked from bennadel/code-1.htm
Ask Ben: Parsing CSV Strings With Javascript Exec() Regular Expression Command
<script type="text/javascript">
// This will parse a delimited string into an array of
// arrays. The default delimiter is the comma, but this
// can be overriden in the second argument.
function CSVToArray( strData, strDelimiter ){
// Check to see if the delimiter is defined. If not,
// then default to comma.
strDelimiter = (strDelimiter || ",");
@danmo91
danmo91 / GradientView.swift
Created March 12, 2016 16:29
Swift Gradient View
import UIKit
class GradientView: UIView {
override class func layerClass() -> AnyClass {
return CAGradientLayer.self
}
func initGradient() {
-- Add isOnVacation
alter table onVacation
add isOnVacation bit;
-- compute column values
update onVacation
set isOnVacation=1
where CURDATE() > onVacation.start AND CURDATE() < onVacation.end;
set @listOfids=(select id from onVacation where isOnVacation=1);
@danmo91
danmo91 / createQuestion.cs
Last active December 17, 2015 01:06
How to create a new question
// in home controller
[HttpPost]
public ActionResult createQuestion(FormCollection form, int missionID)
{
// get question text from form
string question_text = form["Question"].ToString();
// lookup current user in database to get userID
var currentUserEmail = User.Identity.Name;
User user = db.Users.Where(u => u.UserEmail == currentUserEmail);
@danmo91
danmo91 / dropdown.html
Created October 28, 2015 23:47
Bootstrap Dropdown
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Missions
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<!-- clicking on Missouri St. Louis takes me to the Mission action method and passes the name parameter -->
<li><a href="Mission?name=Missouri">Missouri St. Louis</a></li>