Skip to content

Instantly share code, notes, and snippets.

@bamanzi
bamanzi / evernote-search.py
Created November 21, 2012 06:03
search evernote notes by keywords in title
#!/usr/bin/python
#search evernote notes keywords in title
import sqlite3
def main(endbfile, keywords):
conn = sqlite3.connect(endbfile)
cursor = conn.cursor()
sql = """SELECT title, date_created, date_updated, source_url, uid
@techniq
techniq / select2_ajax.js
Created January 23, 2013 16:24
Select2 ajax example with custom query call to append data to the request. Note: Providing ajax settings is not needed (and not used) when query is provided. Left here as a full example.
$("[data-provide='select2']").each(function () {
var $element = $(this);
$element.select2({
placeholder: $element.data("placeholder"),
minimumInputLength: 0,
allowClear: true,
initSelection: function (element, callback) {
callback({
id: $(element).val(),
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 20, 2025 23:00
A badass list of frontend development resources I collected over time.
@ejdyksen
ejdyksen / patch-edid.md
Last active April 20, 2025 08:08
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@ogryzek
ogryzek / databases_with_mapper.md
Last active December 7, 2019 08:03
Databases with Mapper

Databases with Mapper

With what we did yesterday, we were saving everything in memory, so after the request response happens, everything is gone.

To save data from the user, we have different options. We can save the data just to a file. The problem with this is it bcomes slow, and becomes problmeatic, because, what if lots of users are opening the same file at the same file, and searching through a file can become quite slow.

With databases, you structure your data, you put it in a structured fashion. You can easily store and retrieve your data. There are two main database structures. One is called a relational database, and the other is called NoSQL. We may go over a NoSQL DB like MongoDB on a Saturday or something, but for the most part, we will be focusing on relational databases.

NoSQL databases use key values, documents, different ways to store data. Relational databases use a langauge called SQL, which is a language used to query, fetch, and store data in databases. The one we are going to

@danog
danog / dropbox_youtube_dl.sh
Last active March 13, 2022 13:22
Script to download videos from YouTube using Dropbox and IFTTT automation (IFTTT recipe: https://ifttt.com/recipes/277403-download-every-youtube-video-you-add-to-your-watch-later-playlist-automatically)
#!/bin/bash
### Original script by Geoffeg, modified by Roblight and later by me (alias me='alias Danog='Daniil Gentili'')
### How to install this script:
### wget https://gist.githubusercontent.com/danog/f86bf3113e1644b4d5d9/raw/dropbox_youtube_dl.sh -O ~/dropbox_youtube_dl.sh && chmod 755 ~/dropbox_youtube_dl.sh && ~/dropbox_youtube_dl.sh --install
###
### IFTTT Recipe URL: https://ifttt.com/recipes/277403-download-every-youtube-video-you-add-to-your-watch-later-playlist-automatically
if [ "$1" = "--install" ]; then
if [ -f /usr/local/bin/youtube-dl ]; then echo "Youtube-dl already installed."; else echo "Installing youtube-dl..."; sudo curl https://yt-dl.org/downloads/2015.04.03/youtube-dl -o /usr/local/bin/youtube-dl && sudo chmod a+x /usr/local/bin/youtube-dl && echo "YouTube-dl installed successfully." || echo "Couldn't install YouTube-dl."; fi
@arjunvenkat
arjunvenkat / gist:1115bc41bf395a162084
Last active January 12, 2024 05:04
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

@mithereal
mithereal / Git-precommit-hook-mysqldump
Last active April 14, 2021 00:12
Git pre-commit hook for MySQL database backup ( remote mysqldump + Git push )
#!/bin/bash -e
# -e means exit if any command fails
DBHOST=address.to.your.server
DBUSER=username
DBPASS=password # do this in a more secure fashion
DBNAME=DBNAME
GITREPO=/where/is/your/repo
DUMP=$GITREPO/where/you/store/dumps
NEW=$DUMP/schema.sql
OLD=$NEW.old
#!/usr/bin/env ruby
require 'net/http'
require 'json'
class Search
TOPICS = ["Day 1 - Frontend", "Day 2 - Basic Programming", "Day 3 - Loops & Breaks", "Day 4 - OOP", "Day 5 - Intro to Web with Sinatra & Git", "Day 6 - Intro to Ruby on Rails", "Day 7 - Hackathon I", "Day 08 - Rails, Deployment, Pull requests, Code review", "Day 09 - ActiveRecord", "Day 10 - Rails Testing with RSpec", "Day 11 - Users with Devise & Authorization with CanCan(Can)", "Day 12 - File uploads with Carrierwave", "Day 13 - Javascript 1", "Day 14 - SQL and Relations", "Day 15 - Javascript 2 & JQuery", "Day 16 - AJAX & REST", "Day 17 - Integration testing", "Day 18", "Day 19", "Day 20", "Day 21", "Day 22", "Day 23 - Javascript 3", "Day 24 - React 1", "Day 25 - React 2", "Day 26 - React 3", "Day 27 - Testing with Enzyme", "Day 28. FeathersJS", "Advanced Session :: Introduction to d3", "Advanced Session :: Introduction to Docker", "Advanced Session :: Redux", "Advanced Session :: Styling with Sass", "Codaisseur Cloud", "Git & Github",