Skip to content

Instantly share code, notes, and snippets.

View zurfyx's full-sized avatar

Gerard Rovira zurfyx

View GitHub Profile
<html>
<head>
<title>Timetable</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#fcdbff">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js"></script>
</head>
<body>
<div ng-app="timetable" ng-controller="sidebarCtrl">
@zurfyx
zurfyx / k70rgb-boot-fix.sh
Created March 20, 2016 11:24
K70 RGB keyboard long boot time fix - https://github.com/ccMSC/ckb/issues/234
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Run me with sudo"
exit
fi
TARGET_KEY="GRUB_CMDLINE_LINUX_DEFAULT"
REPLACEMENT_VALUE="\"elevator=deadline splash quiet usbhid.quirks=0x1b1c:0x1b13:0x20000000\""
CONFIG_FILE="/etc/default/grub"
@zurfyx
zurfyx / github-api-watching.py
Created April 17, 2016 14:34
Github API - users who you are watching projects of
#!/usr/bin/env python
import requests
import json
import sys
def base_url(user):
return 'https://api.github.com/users/{0}/subscriptions'.format(user)

DJANGO MODEL TYPES

One to One

More information about a Model (only one fits the model extending it)

Example (Car -> Engine)

class Car(models.Model):
@zurfyx
zurfyx / hearthpwn-pack-opener.js
Created April 28, 2016 15:26
Hearthpwn pack-opener
(function($) {
function CardOpener(url, craft_cost, pack_title) {
this.url = url || 'http://www.hearthpwn.com/packs/simulator/4-all-golden-old-gods-pack';
this.craft_cost = craft_cost || 6000;
this.pack_title = pack_title || 'OMG THIS PACK';
};
CardOpener.prototype.open = function() {
var cards = $('.card-back');
<html>
<body>
<div typeof="schema:VideoObject">
<meta property="schema:videoQuality" content="low">
<span property="schema:actor" typeof="schema:Person">
<link property="schema:url" href="http://www.example.com">
</span>
<h1 property="schema:name">Title</h1>
<span property="schema:description">Description</span>
@zurfyx
zurfyx / server.js
Created November 15, 2016 19:25
Express, Socket.io, Passport & Redis.
import http from 'http';
import express from 'express';
import bodyParser from 'body-parser';
import cookieParser from 'cookie-parser';
import expressValidator from 'express-validator';
import Session from 'express-session';
import morgan from 'morgan';
import mongoose from 'mongoose';
import passport from 'passport';
import { createClient as createRedisClient } from 'redis';
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>map vs filter arr</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@zurfyx
zurfyx / index.html
Created March 10, 2017 21:28
cache selector (with & w/o jQuery) (http://jsbench.github.io/#3621d3b9b571cc3640fa988b42c5c873) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>cache selector (with & w/o jQuery)</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@zurfyx
zurfyx / RAM-SSD-HDD.md
Last active March 25, 2017 16:58
RAM vs. SSD vs. HDD
ls -lh | grep x.zip
-rwxrwxrwx 1 zurfyx zurfyx 2.9G Mar 25 17:39 x.zip
time cp x.zip y.zip