This file contains 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
throw new Error('ERROR!'); |
This file contains 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
{ | |
"sheets": [ | |
{ | |
"key": "sheet1", | |
"name": "Example Sheet 1", | |
"columns": [ | |
{ | |
"name": "Column 1", | |
"width": 2, | |
"args": [ |
This file contains 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
from django.db import transaction | |
from django.db.models.deletion import Collector | |
from django.db.models.fields.related import ForeignKey, ManyToManyField, OneToOneField | |
duplicates = [] | |
items = {} | |
client = Client.objects.get(name='Demo') | |
for c in Company.objects.filter(active=True, client=client): | |
company_name = c.name |
This file contains 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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import migrations, models | |
class CopyFieldsBetweenTables(migrations.operations.base.Operation): | |
reversible = False | |
def __init__(self, model_from_name, model_to_name, columns): |
This file contains 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
class Address(models.Model): | |
name = models.CharField(max_length=20) | |
owner = models.ForeignKey('another_app.Owner') | |
class HomeAddress(Address): | |
housekeeper = models.CharField(max_length=50) | |
class WorkAddress(Address): |
This file contains 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
class Address(models.Model): | |
name = models.CharField(max_length=20) | |
owner = models.ForeignKey('another_app.Owner') | |
class Meta: | |
abstract = True | |
class HomeAddress(Address): | |
housekeeper = models.CharField(max_length=50) |
This file contains 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 'capybara' | |
class CapybaraHelper | |
attr_accessor :session | |
def initialize | |
# Register Chrome driver | |
# You might need to install Chrome Driver to make it run (e.g 'brew install chromedriver') | |
Capybara.register_driver :chrome do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) |
This file contains 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
// In order to display a Open Graph Action in your Facebook Share Dialog (FBDialog), you can construct your code like this: | |
NSMutableDictionary<FBOpenGraphAction> *action = (NSMutableDictionary<FBOpenGraphAction> *)[FBGraphObject graphObject]; | |
NSMutableDictionary *graphObject = [FBGraphObject openGraphObjectForPostWithType:@"video.movie" | |
title:@"My movie." | |
image:@"http://www.mymovie.com/poster.jpg" | |
url:@"http://www.mymovie.com" | |
description:@"This movie may contain adult material."]; | |
action[@"movie"] = graphObject; | |
This file contains 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 base64 | |
import random | |
def generate_16char_base32(pre): | |
""" | |
Encode a string of 16 length in base32 | |
with a given string - maximum length of 10 chars - | |
Note: 10 char = 16 char string in base32 | |
Warning: Decoding is not a part of this example |
NewerOlder