Skip to content

Instantly share code, notes, and snippets.

View peketamin's full-sized avatar
🐔
Hello world!

Yuki Yokoyama peketamin

🐔
Hello world!
View GitHub Profile
@thclark
thclark / dataProvider.js
Created October 18, 2019 08:11
A django dataProvider for react-admin v3.x
import { stringify } from 'query-string'
import { fetchUtils } from 'react-admin'
import Cookies from 'universal-cookie'
import { store } from 'index'
const camelCaseKeys = require('camelcase-keys')
const snakeCaseKeys = require('snakecase-keys')
@yano3nora
yano3nora / django.md
Last active November 29, 2021 09:50
[django: Django note] Django - The web framework for perfectionists with deadlines. #django #python

OVERVIEW

djangoproject.com
django/django - github.com
Django documentation - docs.djangoproject.com

Django at a glance - docs.djangoproject.com - 概要、ここ見とけばだいたいわかる
Contents - docs.djangoproject.com
API Reference - docs.djangoproject.com

Python のデファクトスタンダードな WEB アプリフレームワーク。Laravel や Rails などと比較されるリッチめなフレームワークで Youtube, Dropbox, Instagram などが代表例。MVC ではなく MVT - Model / Template / View というデザインになっていて View がプレゼンテーション層 ( どんな風に提供するか? ) を決めるコントローラ的役割 を担い、Template がいわゆるビューテンプレートという考え方。

@voluntas
voluntas / saikyo.rst
Last active September 13, 2023 02:33
ぼくのかんがえたさいきょうの超低遅延大規模配信

ぼくのかんがえたさいきょうの超低遅延大規模配信

更新

2018-08-20

作者

@voluntas

バージョン

18.8.3

URL

https://voluntas.github.io/

@erikbern
erikbern / use_pfx_with_requests.py
Last active May 1, 2024 11:45
How to use a .pfx file with Python requests – also works with .p12 files
import contextlib
import OpenSSL.crypto
import os
import requests
import ssl
import tempfile
@contextlib.contextmanager
def pfx_to_pem(pfx_path, pfx_password):
''' Decrypts the .pfx file to be used with requests. '''
@danni
danni / fields.py
Created March 8, 2016 08:52
Multi Choice Django Array Field
from django import forms
from django.contrib.postgres.fields import ArrayField
class ChoiceArrayField(ArrayField):
"""
A field that allows us to store an array of choices.
Uses Django 1.9's postgres ArrayField
and a MultipleChoiceField for its formfield.
@EtienneR
EtienneR / user.js
Created January 7, 2016 23:39
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@parmentf
parmentf / GitCommitEmoji.md
Last active May 9, 2024 13:47
Git Commit message Emoji
@jeremyjbowers
jeremyjbowers / actions.py
Created November 24, 2015 21:47
Export to CSV for Django admin
import csv
from django.http import HttpResponse
def export_as_csv_action(description="Export selected objects as CSV file", fields=None, exclude=None, header=True):
"""
This function returns an export csv action
'fields' and 'exclude' work like in django ModelForm
'header' is whether or not to output the column names as the first row
"""
def export_as_csv(modeladmin, request, queryset):
@jinstrive
jinstrive / remove_emoji.py
Created October 22, 2015 07:40
python remove emoji in string
def remove_emoji(data):
"""
去除表情
:param data:
:return:
"""
if not data:
return data
if not isinstance(data, basestring):
return data
@Yimiprod
Yimiprod / difference.js
Last active April 5, 2024 13:17
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {