Skip to content

Instantly share code, notes, and snippets.

@jheth
jheth / run_mutant.rb
Created November 9, 2015 02:11
mutant command line
bundle exec mutant --include lib/ --require dynamics_crm --fail-fast --use rspec DynamicsCRM::Client
@jheth
jheth / movies.txt
Created November 3, 2015 02:50
Movies
A Perfect Man
Best of Me - Good
Begin Again - Recommend
Celeste and Jesse Forever - Good
a case of you
@jheth
jheth / table_size.sql
Created November 2, 2015 16:24
MySQL Table Size
SELECT (data_length+index_length)/power(1024,3) tablesize_mb
FROM information_schema.tables
WHERE table_schema='ProposalAgent' and table_name='proposals';
@jheth
jheth / fizzbuzz.js
Created September 21, 2015 17:34
Javascript Fizz Buzz
for (i = 1; i <= 100; i++) {
var f = (i % 3 == 0);
var b = (i % 5 == 0);
if (f && b) {
console.log('fizzbuzz', i);
} else if (f) {
console.log('fizz', i);
} else if (b) {
console.log('buzz', i);
}
@jheth
jheth / gist:87e1e3e8f80e04da7f0a
Created July 22, 2015 19:43
Port Mapping on Gentoo
sudo /sbin/iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 8080
sudo /etc/init.d/iptables save
sudo /etc/init.d/iptables start
@jheth
jheth / gist:d49e6a8d010cd700d5d7
Created June 29, 2015 16:15
Delete Folders older than 30 days
find . -maxdepth 1 -type d -ctime +30 -exec rm -rf {} \;
@jheth
jheth / gist:f5e0d2e12ee529092ed5
Last active August 29, 2015 14:17
Dentaku Search
c = Dentaku::Calculator.new
c.add_function(
name: :blank,
type: :logical,
signature: [:non_group],
body: ->(var) {
ap "Value: #{var}"
return (var.to_s.strip.empty?)
}
@jheth
jheth / gist:22a0e7fb175c1a09c7d6
Created February 20, 2015 21:47
select2 ajax
this.$().select2({
ajax: {
url: "/search",
type: 'GET',
dataType: 'json',
delay: 250,
data: function (term) {
return {
q: term,
id: params.id,
@jheth
jheth / gist:442ee65d9c58e0beaf71
Created February 11, 2015 03:28
Clear Old Session Records
DROP procedure IF EXISTS `ClearSessions`;
DELIMITER $$
CREATE PROCEDURE ClearSessions(IN days_ago INT)
BEGIN
DECLARE bDone INT;
DECLARE count INT;
DECLARE sessionId INT;
@jheth
jheth / Ruby Merge Sort
Created January 25, 2015 03:20
Ruby Merge Sort
def mergesort( a )
n = a.size
return a if ( n == 1 )
l1 = a[0...(n/2)]
l2 = a[(n/2)..n]
l1 = mergesort( l1 )
l2 = mergesort( l2 )