Skip to content

Instantly share code, notes, and snippets.

View IliasDeros's full-sized avatar

Ilias Deros IliasDeros

View GitHub Profile
@cschlyter
cschlyter / mongo_group_by_day.js
Created June 12, 2013 16:46
MongoDB: group by day (aggregate)
var mention_id = 620996;
db.mentionStats.aggregate([
{ $match: {'mention_id': mention_id}},
{ $group: {'_id': {
'year': { '$year': "$verification_date" },
'month': { '$month': "$verification_date" },
'day': { '$dayOfMonth': "$verification_date" }
},
'retweets': { $last: "$retweets" }}},
@NoamB
NoamB / gist:6e940775dfa63c73ee9c
Last active May 15, 2019 18:03
camelize-dasherize mini library
(ns util.camelize-dasherize
(:import (clojure.lang IPersistentMap Keyword))
(:require [clojure.string :as s]
[clojure.zip :as zip]))
; TODO: regex is slow, should try iterating the string.
(defn dasherize-string
"Converts an underscored or camelized string
into an dasherized one."
[s]
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@dahlbyk
dahlbyk / projects.graphql
Created September 15, 2016 00:09
GraphQL to fetch GitHub Projects+Columns+Cards with issue/PR detail for a specific repo.
{
search(type: REPOSITORY, query: "org:huboard-testing spooky-octo-pug", first: 1) {
edges {
node {
__typename
... on Repository {
owner {
id
}
name