Skip to content

Instantly share code, notes, and snippets.

View zanonnicola's full-sized avatar
💭
I like Kotlin

Nicola Zanon zanonnicola

💭
I like Kotlin
View GitHub Profile
@willurd
willurd / web-servers.md
Last active May 28, 2024 06:57
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@fabiofl
fabiofl / gist:5873100
Created June 27, 2013 00:41
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@scaryguy
scaryguy / change_primary_key.md
Last active May 13, 2024 18:43
How to change PRIMARY KEY of an existing PostgreSQL table?
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of  your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
@michael-cannon
michael-cannon / tw_remove_menu_pages.php
Created September 25, 2013 16:00
Remove custom post type submenu pages.
<?php
function tw_remove_menu_pages() {
// remove testimonials menu section
// remove_menu_page( 'edit.php?post_type=testimonials-widget' );
// remove categories
remove_submenu_page( 'edit.php?post_type=testimonials-widget', 'edit-tags.php?taxonomy=category&amp;post_type=testimonials-widget' );
// remove tags
@derekjohnson
derekjohnson / webfonts.js
Last active December 28, 2015 18:49
Font loader
(function(win, doc, undefined) {
// sanity check - is it a decent browser
if('addEventListener' in win && 'localStorage' in win && 'querySelector' in doc) {
// https://gist.github.com/scottjehl/5406853
var injectref = doc.getElementsByTagName('script')[0],
loadCSS = function(href) {
var fontslink = doc.createElement('link');
@mikhailov
mikhailov / gist:9639593
Last active November 10, 2023 22:04
Nginx S3 Proxy with caching
events {
worker_connections 1024;
}
http {
default_type text/html;
access_log /dev/stdout;
sendfile on;
keepalive_timeout 65;
@mariusGundersen
mariusGundersen / moduleImports.js
Created June 9, 2014 20:05
Potential module import syntax in ES6
module _ from "underscore";
import _ from "underscore";
import module _ from "underscore";
import {each, map, find} from "underscore";
import "underscore";
import default _ from "underscore";
const _ = System.import("underscore");
import "underscore" as _;
import {_} from "underscore";
import {each as forEach} from "underscore";
@staltz
staltz / introrx.md
Last active May 28, 2024 17:42
The introduction to Reactive Programming you've been missing
@hdragomir
hdragomir / index.html
Created July 7, 2014 09:48
IIFE version of SM Font Loading
<script type="text/javascript">
(function (css_href) {
"use strict";
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
} else if (el.attachEvent) {
el.attachEvent("on" + ev, callback);
@Gerhard-Kanzler
Gerhard-Kanzler / cache.js
Last active September 20, 2015 10:34
Css Caching in sessionstorage
var css_href_array = [];
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var styleTags = document.getElementsByClassName('js-style');
function getBrowser() {
var myAgent = navigator.userAgent.toLowerCase();
if( myAgent.indexOf('msie') != -1 && parseInt(myAgent.split('msie')[1]) == 8 ){
return 'ie8';