Skip to content

Instantly share code, notes, and snippets.

View kalaomer's full-sized avatar
🐎
Focusing

Ömer Kala kalaomer

🐎
Focusing
View GitHub Profile
@inecmc
inecmc / vue-history-prerender-nginx.md
Created March 2, 2018 06:54
Nginx config for Vue.js history mode + Prerender.io
# Force to use https
server {
    listen 80;
    listen [::]:80;
    server_name example.com;
    return 301 https://$server_name$request_uri;
}

# Default server configuration
@LowerDeez
LowerDeez / admin.py
Last active February 17, 2023 05:15
Django. Admin Tabular Inline initial data
from django.utils.functional import curry
class DetailsInline(admin.TabularInline):
model = Details
# formset = DetailsFormset
extra = 3
def get_formset(self, request, obj=None, **kwargs):
initial = []
if request.method == "GET":
@primaryobjects
primaryobjects / mouse.gif
Last active June 27, 2022 18:24
View the mouse pointer position in Selenium Nightwatch. Execute this code when the page loads or in the javascript console. See https://stackoverflow.com/a/35867777
mouse.gif
@budparr
budparr / robots.txt
Last active August 13, 2019 14:21
Jekyll Robots page to exclude from robots pages that are excluded from the sitemap
---
layout: null
permalink: robots.txt
---
# filter pages and documents for the noindex key
{% assign noindexPages = site.pages | where: 'sitemap', false %}
{% assign noindexDocuments = site.documents | where: 'sitemap', false %}
User-agent: *
# robotstxt.org - if _config production variable is false robots will be disallowed.
{% if site.production != true %}
@llann
llann / validators.py
Created January 24, 2016 22:51 — forked from jrosebr1/validators.py
Validator for files, checking the size, extension and mimetype for Django.
# @brief
# Performs file upload validation for django. The original version implemented
# by dokterbob had some problems with determining the correct mimetype and
# determining the size of the file uploaded (at least within my Django application
# that is).
# @author dokterbob
# @author jrosebr1
import mimetypes
anonymous
anonymous / Bahceli.php
Created October 19, 2015 16:41
<?php
class Bahceli {
function __call($name, $args) {
if (preg_match('/yak|dov/i', $name)) {
return true;
} else {
return false;
}
}
@ErisDS
ErisDS / examples.md
Last active May 2, 2024 08:23
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@emir
emir / gist:0dd5bf71af9205ad8658
Last active August 29, 2015 14:24
PHPKonf - Öğrenciler için

Selamlar,

İstanbul PHP kullanıcı grubu olarak, 25/26 Temmuz tarihlerinde düzenliyoruz olduğumuz İstanbul PHP Konferansı için öğrenci arkadaşlarımıza $15 değerinde standart bileti ücretsiz dağıtmak istiyoruz.

Sizlerden beklentimiz ise (Aşağıdaki maddelerde sadece 10 Temmuz tarihi itibarıyla yaptığınız katkılar geçerlidir):

  • Açık kaynak bir projenin bir issue'na commit atmak(Bugfix/Improvements vb.).
  • Açık kaynak bir projenin Türkçe çevirisine katkıda bulunmak.
  • Min. 300 kelime PHP ile ilgili Türkçe blog yazısı yazmak.
@trhura
trhura / cvpicker.py
Created October 12, 2014 03:40
opencv color picker
#! /usr/bin/env python2
import cv2
import numpy as np
colors = []
def on_mouse_click (event, x, y, flags, frame):
if event == cv2.EVENT_LBUTTONUP:
colors.append(frame[y,x].tolist())
"""
Select database based on URL variable
Inspired by this Django snipped:
https://djangosnippets.org/snippets/2037/
It's assumed that any view in the system with a cfg keyword argument passed to
it from the urlconf may be routed to a separate database. for example: