Skip to content

Instantly share code, notes, and snippets.

View ahmetonurslmz's full-sized avatar
🎯
Focusing

Ahmet Onur Solmaz ahmetonurslmz

🎯
Focusing
View GitHub Profile
@repodevs
repodevs / django_undo_migration.md
Created February 2, 2020 18:45
How to undo migration in Django

Let say you have migrations like this

project/apps/accounts/migrations
├── 0001_initial.py
├── 0002_historicalprofile_historicaluser.py
├── 0003_auto_20190807_1559.py
├── 0004_auto_20190811_1013.py
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@fgilio
fgilio / axios-catch-error.js
Last active August 15, 2024 01:45
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@Birdie0
Birdie0 / ifttt-webhooks-extended-guide.md
Last active November 1, 2024 08:43
How to use Discord Webhooks

⚠️ This gist is no longer updated! For maintained, improved and even more extended guide click here.


How to use Discord Webhook

It's a JSON

First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.

@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active November 18, 2024 08:23
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@pandafulmanda
pandafulmanda / Python3 Virtualenv Setup.md
Last active October 5, 2024 17:12 — forked from akszydelko/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@vivekhub
vivekhub / mdel.lua
Created November 1, 2014 10:49
Implementing MDEL in Redis
--!/usr/bin/env lua
local delpattern = KEYS[1]
local count = 0
local valuelist = redis.call('keys', delpattern)
if valuelist then
for i = 1, #valuelist do
redis.call('del', valuelist[i])
count = count + 1
end
@nemesifier
nemesifier / dynamic_relationships_mixin.py
Last active March 1, 2021 04:34
Django Rest Framework Dynamic relationships mixin
# USAGE EXAMPLE:
# https://github.com/nemesisdesign/nodeshot/blob/09d5307fa38861339a660ba96b2c79f9c19ec92a/nodeshot/core/layers/models/__init__.py
from django.core.urlresolvers import NoReverseMatch
from rest_framework import serializers
from rest_framework.fields import Field
from rest_framework.reverse import reverse
@xulapp
xulapp / callable.js
Created March 12, 2010 07:51
__call__ in JavaScript
function Callable() {
var self = function Callable()
this.__call__.apply(this, arguments);
self.__proto__ = Callable.prototype;
return self;
}
Callable.prototype = {
constructor: Callable,
__proto__: Function.prototype,
__call__: function __call__() {