Skip to content

Instantly share code, notes, and snippets.

View kimenye's full-sized avatar

Trevor Kimenye kimenye

View GitHub Profile
@kimenye
kimenye / gist:fb028c38f169d87a8d3c3b92cee63ac3
Created March 19, 2017 09:20
Recovering your mysql root password
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD("secure_password") where User='root';
@kimenye
kimenye / gist:eef321a2a182bd4544af
Created August 6, 2014 09:59
WhatsApp manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="48513" android:versionName="2.11.301" package="com.whatsapp">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION">
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION">
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE">
@kimenye
kimenye / jquery.smint.js
Created May 20, 2014 10:33
Modified version of SMIT
/*
SMINT V1.0 by Robert McCracken
SMINT V2.0 by robert McCracken with some awesome help from Ryan Clarke (@clarkieryan) and mcpacosy ‏(@mcpacosy)
SMINT is my first dabble into jQuery plugins!
http://www.outyear.co.uk/smint/
If you like Smint, or have suggestions on how it could be improved, send me a tweet @rabmyself
@kimenye
kimenye / _navigation_links.html.erb
Last active December 28, 2015 20:59
Creating the NDS library application
RailsAdmin.config do |config|
config.actions do
dashboard
index
new
show
edit
delete
collection :upload_renewals do
@kimenye
kimenye / jQuery Wiggle
Created October 10, 2012 08:35
jQuery Wiggle using JQUERY Transit
/*!
* jQuery Wiggle
* http://www.userdot.net/#!/jquery
*
* Copyright 2011, UserDot www.userdot.net
* Licensed under the GPL Version 3 license.
* Version 1.0.0
*
* Updated by http://github.com/kimenye
*
@kimenye
kimenye / Supermarket
Created October 3, 2012 11:13
Supermarket
class Fruit
attr_accessor :type, :unit_price, :discount_quantity, :discount_price, :offer
def initialize(type,unit_price, discount_quantity=nil, discount_price=nil, offer=false)
@type = type
@unit_price = unit_price
@discount_quantity = discount_quantity
@discount_price = discount_price
@offer = offer
end
@kimenye
kimenye / first_non_repeating_character
Created September 17, 2012 12:59
How to detect the first non-repeating character in a line
def detect_character_that_occurs_only_once line
if !line.nil?
the_char = line.each_char.detect { |char| line.count(char) == 1}
end
the_char
end
@kimenye
kimenye / heroku_mongomapper
Created July 16, 2012 06:08
Sinatra + MongoMapper + MongoHQ + Heroku
if ENV['MONGOHQ_URL']
uri = URI.parse(ENV['MONGOHQ_URL'])
MongoMapper.connection = Mongo::Connection.from_uri(ENV['MONGOHQ_URL'])
MongoMapper.database = uri.path.gsub(/^\//, '')
puts ">> db is #{uri.path.gsub(/^\//, '')}"
end
@kimenye
kimenye / MongoHQURL
Created March 15, 2012 14:54
A utility for converting a MONGOHQ url to an object so that mongo engine can connect to it.
# -*- coding: utf-8 -*-
"""
MongoHQURL
~~~~~~~~~~
A utility for converting a MONGOHQ url to an object so that mongo engine can connect to it.
usage:
------
from util import MongoHQURL