Skip to content

Instantly share code, notes, and snippets.

View roxeteer's full-sized avatar

Visa Kopu roxeteer

View GitHub Profile
@roxeteer
roxeteer / gist:2658590
Created May 11, 2012 09:18
Bookmarklet kauppalehti.fi:n paywallin kiertämiseen
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){$("#registration,.floatBackground").hide()});
@roxeteer
roxeteer / models.py
Created July 2, 2012 12:34
Create unique slugs in Django
from django.template.defaultfilters import slugify
def slugify_unique(value, model, slugfield="slug", max_length=None):
"""
Check against the database that the slug is unique and automatically increase a counter.
Optionally check that the slug doesn't grow too long for the slug field.
"""
slug = baseslug = slugify(value)
counter = 1
from django.views.generic import TemplateView
class ClassView(TemplateView):
template_name = "custom_view.html"
def get_context_data(self, **kwargs):
# This allows this View to be easily subclassed in the future to interchange context data.
context = kwargs
return context
@roxeteer
roxeteer / INSTALL
Created November 20, 2012 08:14
Chrome extension to break a paywall
Tallenna nämä tiedostot koneellesi omaan hakemistoonsa. Muokkaa
manifest.json-tiedostossa oleva nettisivun osoite osoittamaan erään
suomalaisen päivälehden oikeaan osoitteeseen.
Avaa Chromessa Extensions-näkymä ja klikkaa "Load unpacked extension..."
Valitse luomasi hakemisto ja klikkaa Select. Paywall Breakerin pitäisi
ilmestyä listalle ja muurien murtua automaattisesti kun menet
manifest.jsoniin syöttämääsi osoitteeseen.
@roxeteer
roxeteer / float_separators.js
Last active December 13, 2015 22:28
JavaScript: Add thousands separators
// add separators to any kind of a number
function sep(val) {
if (!val) return val;
var s = val + "",
components = s.split("."),
x = components[0].split("");
for (var i = x.length - 3; i > 0; i -= 3) {
x.splice(i, 0, ",");
x Referral Traffic (Visits) Visitors Weekly test Media orders
2014-08-30 0.0
2014-08-31 327.00 7695.00 0.0
2014-09-01 365.00 10281.00 0.0
2014-09-02 297.00 9568.00 0.0
2014-09-03 382.00 9409.00 0.0
2014-09-04 348.00 9101.00 0.0
2014-09-05 297.00 7815.00 0.0
2014-09-06 170.00 6301.00 0.0
2014-09-07 293.00 7489.00 0.0
x Referral Traffic (Visits) Visitors Weekly test Media orders
2014-01-01 323.00 8684.00 8296.49
2014-01-02 180.00 9152.00 8296.49
2014-01-03 180.00 9420.00 41878.05
2014-01-04 180.00 8824.00 8296.49
2014-01-05 252.00 8880.00 8296.49
2014-01-06 108.00 8562.00 0.0
2014-01-07 216.00 9742.00 0.0
2014-01-08 72.00 9740.00 0.0
2014-01-09 36.00 9446.00 0.0
x Event Description Referral Traffic (Visits) Visitors Weekly test Media orders
1388534400000 323.00 8684.00 8296.49
1388620800000 180.00 9152.00 8296.49
1388707200000 180.00 9420.00 41878.05
1388793600000 180.00 8824.00 8296.49
1388880000000 252.00 8880.00 8296.49
1388966400000 108.00 8562.00 0.0
1389052800000 216.00 9742.00 0.0
1389139200000 72.00 9740.00 0.0
1389225600000 36.00 9446.00 0.0
var restify = require('restify');
// create server instance
var server = restify.createServer();
// configure middleware
server.use(restify.bodyParser());
server.use(restify.CORS());
// TODO: configure routes here

Keybase proof

I hereby claim:

  • I am roxeteer on github.
  • I am roxeteer (https://keybase.io/roxeteer) on keybase.
  • I have a public key ASCkfApozNBE8hVYMSKWGzGG4OMReS6NgRMIdnAKZi4bFQo

To claim this, I am signing this object: