Skip to content

Instantly share code, notes, and snippets.

@lightonphiri
lightonphiri / bash-install_google_fonts_on_ubuntu.md
Last active May 27, 2024 17:53
Install Google Fonts on Ubuntu

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

@Bhavdip
Bhavdip / sketch-never-ending.md
Created October 6, 2016 15:53
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@ianjosephwilson
ianjosephwilson / runlint.py
Created August 2, 2016 21:15
Testing out the mini racer v8 interface with Douglas Crockford's jslint.js from http://www.jslint.com/.
"""
Testing out the py mini racer v8 interface with Douglas Crockford's jslint.js from http://www.jslint.com/.
"""
import sys
from py_mini_racer import py_mini_racer
HTML_PAGE_FORMAT = """<!DOCTYPE html>
<head>
<meta charset="utf-8">
@mattkohl
mattkohl / .block
Last active March 26, 2024 18:26
Force-Directed Graph with Multiple Labelled Edges between Nodes
license: gpl-3.0
@kof
kof / action-creator-vs-reducer.md
Last active January 18, 2020 09:06
Action creator vs. reducer

When should you use action creator and when reducer?

Action creator

  • you need to have side effects
  • you need to read from store to decide what to do
  • you need to dispatch more than one action
  • action produced by action creator needs to contain all the data reducer can need to shape the components state

Reducer

  • should not have any side effects
@nicolov
nicolov / Cargo.toml
Last active December 30, 2020 12:20
Rust API with Mysql
[package]
name = "api_example"
version = "0.1.0"
authors = ["nicolov"]
[dependencies]
iron = "*"
router = "*"
mysql = "*"
r2d2 = "*"
@cdinu
cdinu / getxypercent.js
Created September 25, 2015 13:42
Get XY coordinates as percentages
// 1. Load an image in a new tab
// 2. Open JS console. Leave it open
// 3. Paste this
var s = document.createElement('script');
s.setAttribute('src','https://code.jquery.com/jquery-2.1.4.min.js');
document.head.appendChild(s);
// 4. Then paste this
var oldx = 0, oldy = 0;
@mindplay-dk
mindplay-dk / session-life-cycle.md
Last active March 28, 2024 19:52
Complete overview of the PHP SessionHandler life-cycle

This page provides a full overview of PHP's SessionHandler life-cycle - this was generated by a set of test-scripts, in order to provide an exact overview of when and what you can expect will be called in your custom SessionHandler implementation.

Each example is a separate script being run by a client with cookies enabled.

To the left, you can see the function being called in your script, and to the right, you can see the resulting calls being made to a custom session-handler registed using session_set_save_handler().

@adamfeuer
adamfeuer / D3JS Tree Editor.md
Last active November 13, 2023 09:56
d3js tree editor with node create, delete, and rename
We couldn’t find that file to show.
@SevenW
SevenW / HTTPWebSocketsHandler.py
Last active October 23, 2023 13:10
HTTPWebSocketsHandler extends SimpleHTTPServer with WebSockets enabling the use of HTTP and WebSockets throught the same port
'''
The MIT License (MIT)
Copyright (C) 2014, 2015 Seven Watt <info@sevenwatt.com>
<http://www.sevenwatt.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.