Skip to content

Instantly share code, notes, and snippets.

ando dre1080

Block or report user

Report or block dre1080

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dre1080
dre1080 / libimobiledevice_ifuse_Ubuntu.md
Created Mar 5, 2018 — forked from samrocketman/libimobiledevice_ifuse_Ubuntu.md
On Ubuntu 16.04, since iOS 10 update, libimobiledevice can't connect to my iPhone. This is my attempt to document a fix.
View libimobiledevice_ifuse_Ubuntu.md

Why this document?

I upgraded my iPhone 5s to iOS 10 and could no longer retrieve photos from it. This was unacceptable for me so I worked at achieving retrieving my photos. This document is my story (on Ubuntu 16.04).

The solution is to compile libimobiledevice and ifuse from source.

Audience

Who is this guide intended for?

@dre1080
dre1080 / api.php
Created May 16, 2017
Disable WordPress REST API endpoints
View api.php
// Remove init rest routes
remove_action( 'rest_api_init', 'create_initial_rest_routes', 0 );
// Remove oembed rest routes
function remove_json_api () {
// Remove the REST API lines from the HTML Header
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
@dre1080
dre1080 / localhost-tld.md
Last active Apr 18, 2020 — forked from marek-saji/dev-tld.md
Configure local DNS server to serve *.localhost domains
View localhost-tld.md

Configure local wildcard DNS server

  1. Install Dnsmasq: sudo apt-get install dnsmasq

  2. Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up /etc/NetworkManager/NetworkManager.conf and comment out (#) the line that reads dns=dnsmasq. Restart NetworkManager afterwards: sudo systemctl restart NetworkManager.

  3. Make sure Dnsmasq listens to local DNS queries by editing /etc/dnsmasq.conf, and adding the line listen-address=127.0.0.1.

@dre1080
dre1080 / soft-delete.sql
Last active Feb 10, 2016
Soft-deletable records in Postgres
View soft-delete.sql
CREATE FUNCTION soft_delete()
RETURNS trigger AS $$
BEGIN
EXECUTE 'UPDATE '
|| TG_TABLE_NAME
|| ' SET deleted_at = current_timestamp WHERE id = $1'
USING OLD.id;
RETURN OLD;
END;
$$ LANGUAGE plpgsql
@dre1080
dre1080 / util.go
Last active Sep 30, 2015
Print Echo registered routes
View util.go
package util
import (
"log"
"strings"
"github.com/labstack/echo"
)
// DebugPrintRoutes prints all registered routes of e.
View box-shadow.html
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
View database.rake
require 'yaml'
require 'logger'
require 'active_record'
namespace :db do
def create_database config
options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
create_db = lambda do |config|
ActiveRecord::Base.establish_connection config.merge('database' => nil)
@dre1080
dre1080 / all2coffee.sh
Created Nov 9, 2013
Js2Coffee a directory recursively. Excludes node_modules, app/assets and public directories.
View all2coffee.sh
for FILE in `find . -name "*.js" -type f -o -path './node_modules' -prune -o -path './app/assets' -prune -o -path './public' -prune`
do
if [ -e $FILE ] ; then
COFFEE=${FILE//.js/.coffee}
echo "converting ${FILE} to ${COFFEE}"
js2coffee "$FILE" > "$COFFEE"
else
echo "File: {$1} does not exist!"
fi
View pesapal.rb
module PesaPal
require 'active_support'
include ActiveSupport::Configurable
self.configure do |config|
config.test_mode = true
config.consumer_key = "<your key>"
config.consumer_secret = "<your secret>"
end
You can’t perform that action at this time.