This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" onkeyup="filter(this)"/> | |
<div class="row">blah</div> | |
<div class="row">blah blah</div> | |
<div class="row">blah blah blah</div> | |
<script> | |
function filter(e){ | |
search = e.value.toLowerCase(); | |
document.querySelectorAll('.row').forEach(function(row){ | |
text = row.innerText.toLowerCase(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Usage | |
# ./s3upload.bash path/to/file.txt name-of-file-on-s3.txt | |
# | |
file="$1" | |
path="$2" | |
key_id="s3 key goes here" | |
key_secret="s3 secret goes here" | |
bucket="bucket name goes here" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Bash script for uploading videos to Youtube.com | |
# | |
# Usage: | |
# ./youtube.bash path-to-movie-movie.mov | |
# | |
# Setup | |
# Goto https://console.developers.google.com | |
# Create app, enable Youtube Data API and create OAuth credentials, client id and client secret. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LoadingOverlay.swift | |
// app | |
// | |
// Created by Igor de Oliveira Sa on 25/03/15. | |
// Copyright (c) 2015 Igor de Oliveira Sa. All rights reserved. | |
// | |
// Usage: | |
// | |
// # Show Overlay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json, re | |
import dateparser | |
from django.db import models | |
from django.forms.models import model_to_dict | |
from uuid import uuid4, UUID | |
from datetime import date, datetime | |
from django.template.defaultfilters import slugify | |
class ModelEncoder(json.JSONEncoder): | |
def default(self, obj): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Run the following commands (bc. gists don't allow directories) | |
pip install flask django dj-database-url psycopg2 | |
mkdir -p app/migrations | |
touch app/__init__.py app/migrations/__init__.py | |
mv models.py app/ | |
python manage.py makemigrations | |
python manage.py migrate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
text = ' asdfladf ljklasfj 2324@#$@#$@#43-----hi' | |
print re.sub(r'\W+', '-', text).strip('-') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a | |
b | |
c | |
d | |
e | |
f | |
g | |
h | |
i | |
j |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# pip install django-micro | |
# | |
# *make sure the label for model meta property is set to the name of current directory* | |
# | |
# python app.py makemigrations | |
# python app.py migrate | |
# python app.py runserver | |
# | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest-client' | |
require 'json' | |
def lookup_address(address) | |
begin | |
address_data = JSON.parse(RestClient.get("https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=#{address}")) | |
address = address_data['results'][0]['formatted_address'] | |
location = address_data['results'][0]['geometry']['location'] | |
timezone_data = lookup_timezone("#{location['lat']},#{location['lng']}") |