Skip to content

Instantly share code, notes, and snippets.

View nitely's full-sized avatar
🟢
online

Esteban C Borsani nitely

🟢
online
View GitHub Profile
@Warry
Warry / Article.md
Created December 11, 2012 00:11
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@stvbdn
stvbdn / Django Haystack Solr Setup
Last active March 28, 2019 11:54
Django + Haystack + Solr Installation/Setup
### Solr Install ###
Install pysolr and django-haystack and set up django-haystack. Setup for haystack is pretty straight forward:
https://django-haystack.readthedocs.org/en/v1.2.7/tutorial.html
Make sure you follow the haystack instructions for the correct version of haystack that you installed,
as some of the setting variables are different depending on the version.
# SSH into the server that you want to install Solr on
@lojikil
lojikil / fnv.c
Created March 23, 2013 14:58
Fowler-Nolls-Vo hash implementations
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
uint64_t
fnv(char *key, uint32_t len)
{
uint64_t hash = 14695981039346656037;
uint32_t idx = 0;
for(; idx < len; idx++)
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
import sys
import re
def fnv32a( str ):
hval = 0x811c9dc5
fnv_32_prime = 0x01000193
uint32_max = 2 ** 32
for s in str:
hval = hval ^ ord(s)
hval = (hval * fnv_32_prime) % uint32_max
@postrational
postrational / gunicorn_start.bash
Last active April 4, 2024 12:48
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@dmitric
dmitric / mdx_video.py
Created August 19, 2013 07:40
A dead simple python markdown extension to embed youtube or vimeo videos in markdown. Using oembed is a terrible idea if you have lots of links on a page, and the other implementations I saw were sloppy. You can still use regular links to vimeo and youtube too.
# -*- coding: utf-8 -*-
from markdown import Extension
from markdown.util import etree
from markdown.inlinepatterns import Pattern
SOURCES = {
"youtube": {
"re": r'youtube\.com/watch\?\S*v=(?P<youtube>[A-Za-z0-9_&=-]+)',
"embed": "//www.youtube.com/embed/%s"
},
$ cat test.js
function foo () { while (true) { } }
function bar () { return foo(); }
bar();
$ node test.js &
$ gdb attach $(pidof node)
0x00000bf778c63d5f in ?? ()
(gdb) b v8::internal::Runtime_StackGuard
Breakpoint 1 at 0x84a1f0
(gdb) print 'v8::V8::TerminateExecution'(0)
@tonyseek
tonyseek / README.rst
Last active November 5, 2022 15:20
Build Python binding of C++ library with cffi (PyPy/Py3K compatible)

Run with Python:

pip-2.7 install cffi
PYTHON=python2.7 sh go.sh

Run with PyPy:

pip-pypy install cffi
PYTHON=pypy sh go.sh
@anlutro
anlutro / virtualhost
Created March 19, 2014 14:14
Separate app in subdirectory for Apache (Laravel 4 and AngularJS example)
<VirtualHost *:80>
# Client AngularJS application
DocumentRoot /var/www/example/client/public
# Server Laravel 4 API application
Alias /api /var/www/example/server/public
# Rewrite all requests in /api to server index.php
<Location /api>