Skip to content

Instantly share code, notes, and snippets.

View epistrephein's full-sized avatar

Tommaso Barbato epistrephein

View GitHub Profile
@klcodanr
klcodanr / jekyll-init-script
Last active January 14, 2016 10:53
Shell script for Jekyll to loaded on server load.
#!/bin/sh
# jekyll Starts and stops Jekyll
#
#
# chkconfig: - 85 15
# description: Jekyll is a Ruby based website caching engine
# processname: jekyll
# pidfile: /var/run/jekyll.pid
# Configure your values here
diff -ruN snes9x-1.53-src.orig/macosx/mac-cart.mm snes9x-1.53-src/macosx/mac-cart.mm
--- snes9x-1.53-src.orig/macosx/mac-cart.mm 2011-04-24 22:38:10.000000000 +0900
+++ snes9x-1.53-src/macosx/mac-cart.mm 2014-12-06 15:06:35.000000000 +0900
@@ -214,7 +214,7 @@
FSRef ref;
Boolean reply;
char name[PATH_MAX + 1];
-#ifdef MAC_LEOPARD_TIGER_PANTHER_SUPPORT
+#if defined(MAC_LEOPARD_TIGER_PANTHER_SUPPORT) || defined(MAC_YOSEMITE_SUPPORT)
IBNibRef customNib;
anonymous
anonymous / gist:b1b3b128de491fc97f0e
Created December 18, 2014 15:35
# dig @staite.net old.staite.net
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @staite.net old.staite.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5594
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
@dazza-codes
dazza-codes / basic_faraday_json_client.rb
Created February 13, 2016 21:13
Faraday JSON client
require 'faraday'
require 'faraday_middleware'
class Client
JSON_CONTENT = 'application/json'
attr_reader :conn
# Initialize a new client
def initialize
@base_uri = 'https://api.example.org'
@steipete
steipete / UITableViewMore.m
Last active January 29, 2018 14:19
Using the "More" button. Of course the simple way that Apple uses in Mail/iOS is not public. rdar://16600859
- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
return @"More";
}
- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"I wanted to be a pretty public API, but then time ran out and they forgot me...");
// Hide the More/Delete menu.
[self setEditing:NO animated:YES];
}
@i-scorpion
i-scorpion / README.txt
Created June 18, 2012 12:24
Twitter bootstrap fixed table header using jQuery
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled.
Using the code from twitter bootstrap documentation page, this code is customized for table header.
Create the table with following layout -
<table class="table-fixed-header">
<thead class="header">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
@chezou
chezou / Gemfile
Last active May 11, 2019 16:35
Example code of ruby with Amazon Polly
source 'https://rubygems.org'
gem 'nokogiri', '~>1.6'
gem 'aws-sdk', '~> 2'
@MyklClason
MyklClason / Gemfile.rb
Last active June 5, 2019 20:35
Search/Sort/Paginate with Ransack and Kaminari
...
gem 'kaminari'
gem 'ransack'
..
@czj
czj / gist:1251031
Created September 29, 2011 15:43
.irbrc that runs Pry instead of IRB
# This script comes from Pry Everywhere by Luca Pette
# http://lucapette.com/pry/pry-everywhere/
# https://github.com/carlhuda/bundler/issues/183#issuecomment-1149953
if defined?(::Bundler)
global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first
if global_gemset
all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*")
all_global_gem_paths.each do |p|
gem_path = "#{p}/lib"
@TylerRick
TylerRick / delegate_to_all.rb
Last active March 29, 2020 06:01
DelegateToAll. Like delegate.rb from Ruby's std lib but lets you have multiple target/delegate objects.
# DelegateToAll. Like delegate.rb from Ruby's std lib but lets you have multiple target/delegate objects.
require 'delegate'
class DelegatorToAll < Delegator
# Pass in the _obj_ to delegate method calls to. All methods supported by
# _obj_ will be delegated to.
#
def initialize(*targets)
__setobj__(targets)