Skip to content

Instantly share code, notes, and snippets.

View tamagokun's full-sized avatar

Mike Kruk tamagokun

View GitHub Profile
@ssokolow
ssokolow / index.php
Created July 6, 2012 03:39
Basic stub for mod_rewrite-like behaviour using PHP 5.4's development server
<?php
// To the extent possible under law, I (Stephan Sokolow) waive all copyright and related or
// neighbouring rights to this code snippet. (Though it'd still be nice if you mention me)
// If we're running under `php -S` with PHP 5.4.0+
if (php_sapi_name() == 'cli-server') {
// Replicate the effects of basic "index.php"-hiding mod_rewrite rules
// Tested working under FatFreeFramework 2.0.6 through 2.0.12.
$_SERVER['SCRIPT_NAME'] = str_replace(__DIR__, '', __FILE__);
@dz0ny
dz0ny / 99java
Created July 7, 2012 10:23
Install java,flash,mp3,mp4 to Chromium OS
## Setup java
if [ `uname -m` == 'x86_64' ]; then
PATH="/usr/lib64/jvm/java-7-oracle/jre/bin/"
JAVA_HOME="/usr/lib64/jvm/java-7-oracle/"
else
PATH="/usr/lib/jvm/java-7-oracle/jre/bin/"
JAVA_HOME="/usr/lib/jvm/java-7-oracle/"
fi
@philfreo
philfreo / gist:3877368
Created October 12, 2012 04:49
Various Backbone-Form custom editors
// like 'Select' editor, but will always return a boolean (true or false)
editors.BooleanSelect = editors.Select.extend({
initialize: function(options) {
options.schema.options = [
{ val: '1', label: 'Yes' },
{ val: '', label: 'No' }
];
editors.Select.prototype.initialize.call(this, options);
},
getValue: function() {
@sumardi
sumardi / nginx.default.conf
Last active November 2, 2024 14:29
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@OpenNingia
OpenNingia / terminal_color_scheme
Last active July 27, 2017 09:01
Simple script to apply Solarized color scheme to Pantheon Terminal
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Solarized theme for pantheon-terminal
see http://ethanschoonover.com/solarized
"""
import posixpath
import sys
from gi.repository import Gio
@weissmike
weissmike / flexslider_youtube.js
Last active March 2, 2021 05:03
Flexslider & YouTube Videos - Pause slider when video plays, pause video when slider advances
jQuery(document).ready(function($) {
$.getScript('//www.youtube.com/iframe_api');
var cnt = 0;
$('.flexslider iframe[src*=youtube]').each(function() {
$(this).attr('id', 'youtubeplayer' + cnt);
cnt++;
});
loadSlider();
@tinabeans
tinabeans / template.html
Last active February 13, 2024 09:18
A super-barebones single-column responsive email template, assuming a max-width of 540px. Read about it on the Fog Creek blog.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {
@kyledrake
kyledrake / ferengi-plan.txt
Last active January 10, 2025 14:02
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@tamagokun
tamagokun / bbf-sortable-list.js
Last active August 29, 2015 14:03
bbf-sortable-list.js
Form.editors.SortableList = Form.editors.List.extend({
initialize: function() {
Form.editors.List.prototype.initialize.apply(this, arguments);
},
render: function() {
Form.editors.List.prototype.render.apply(this, arguments);
// sorting
if (!this.sortable) {
@pferreir
pferreir / gist:ebfad73817372aaee0c7
Created August 9, 2014 16:29
weechat-emoji.rb
require 'rumoji'
def render(data, modifier, modifier_data, message)
Rumoji.decode(message)
end
def weechat_init
Weechat.register 'rumoji', 'Pedro Ferreira', '0.0.1', 'MIT',
'Render emoki using Rumoji', '', ''