Skip to content

Instantly share code, notes, and snippets.

View ustun's full-sized avatar

Ustun Ozgur ustun

View GitHub Profile
@NV
NV / Readme.md
Last active January 7, 2025 08:28
Prepend the debugger statement to a function as easy as stopBefore('Element.prototype.removeChild'). Works in Chrome DevTools and Safari Inspector, doesn’t work in Firebug‘s and Firefox Developer Tools‘ console (I don’t know why). Works as a standalone script everywhere.

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
@mattmcc
mattmcc / models.py
Created March 27, 2013 00:24
Quick & dirty "read-only" model for using SQL views
class ViewManager(models.Manager):
def bulk_create(self, *args, **kwargs):
raise NotImplementedError
def create(self, *args, **kwargs):
raise NotImplementedError
def get_or_create(self, *args, **kwargs):
raise NotImplementedError
@bennadel
bennadel / copy.htm
Created January 16, 2013 14:50
Rendering DOM Elements With ngRepeat In AngularJS
<!doctype html>
<html ng-app="Demo" ng-controller="DemoController">
<head>
<meta charset="utf-8" />
<title>Rendering DOM Elements With ngRepeat In AngularJS</title>
</head>
<body>
<h1>
anonymous
anonymous / settings_example.py
Created January 8, 2013 23:41
Django Rotating File Log
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters':{
'simple': {
@tclancy
tclancy / django_management_profile.py
Last active January 3, 2023 22:18
Profiling Django Management Command
from cProfile import Profile
from django.core.management.base import BaseCommand
class ProfileEnabledBaseCommand(BaseCommand):
"""Enable profiling a command with --profile.
Requires child class to define _handle instead of handle.
via https://gist.github.com/dfrankow
"""
@bonkydog
bonkydog / classpath.clj
Created October 16, 2012 20:40
print the classpath from clojure
(println (clojure.string/join "\n" (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))))
@areina
areina / emacs-email-setup.md
Created October 12, 2012 15:00
Manage your email in emacs with mu4e

Manage your gmail account in emacs with mu4e

There're a lot of combinations to manage your email with emacs, but this works for me. I've a backup and I can manage my daily email.

The stack:

  • emacs
  • offlineimap
  • mu
  • mu4e
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Deployment.Application;
using System.Globalization;
using System.Linq;
using System.Reactive.Linq;
using System.Timers;
using System.Windows;
@datagrok
datagrok / gist:2199506
Last active December 16, 2024 16:14
Virtualenv's `bin/activate` is Doing It Wrong