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
<?php | |
// This is how you would declare arrays in PHP (version 5.4+) | |
$someArray = [ | |
"first value", | |
"second value" | |
]; | |
// PHP Arrays are apparently also hash maps/dictionaries/whatever | |
$person = [ |
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
card1 = { | |
'name': 'John Smith', | |
'age': 20, | |
'gpa': 3.0, | |
'pointer': None | |
} | |
card1 | |
card2 = { | |
'name': 'Amanda Jones', |
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
# Postgres | |
psql -d postgres | |
CREATE USER user_name WITH PASSWORD 'password'; | |
CREATE DATABASE database_name WITH OWNER user_name; | |
# MySQL | |
mysql -u root -p | |
CREATE DATABASE database_name; | |
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON database_name.* TO 'newuser'@'localhost'; |
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
# Requires pydub (with ffmpeg) and Pillow | |
# | |
# Usage: python waveform.py <audio_file> | |
import sys | |
from pydub import AudioSegment | |
from PIL import Image, ImageDraw | |
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
""" | |
MIT License | |
Copyright (c) 2018 Mitchel Cabuloy | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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 import forms | |
from django.core import exceptions | |
from django.db import models | |
from django.utils.encoding import force_text | |
class MultipleSelectFormField(forms.MultipleChoiceField): | |
widget = forms.CheckboxSelectMultiple | |
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 import forms | |
from django.core.exceptions import ValidationError | |
from django.db import transaction | |
class InvalidInputsError(Exception): | |
def __init__(self, errors, non_field_errors): | |
self.errors = errors | |
self.non_field_errors = non_field_errors |
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 $ from 'jquery' | |
import './styles.scss' | |
import CarouselControls from '../CarouselControls' | |
import CarouselDots from '../CarouselDots' | |
import CarouselSlider from '../CarouselSlider' | |
import mod from '../../lib/mod' | |
class CarouselBlock { |
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
@mixin vertical-grid($line-height: 24px) { | |
position: relative; | |
&::before { | |
$stripe-color: rgba(blue, 0.2); | |
background-image: repeating-linear-gradient(to bottom, $stripe-color, $stripe-color $line-height, transparent $line-height, transparent $line-height * 2); | |
bottom: 0; | |
content: ''; | |
left: 0; | |
position: absolute; |
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
Format: [>9999999999]###\,###\,###"g "##"s "#0"c";[>9999999]###\,###"g "##"s "#0"c";#0"g "00"s "00"c"; | |
How it looks | |
0g 00s 00c | |
0g 00s 12c | |
0g 01s 23c | |
0g 12s 34c // Does not support hiding silver/copper | |
1g 23s 45c | |
12g 34s 56c | |
123g 45s 67c |