This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Try to load gem information from spec file. Often fails due to gemspec referencing git commands. | |
Dir.glob(ENV['GEM_HOME'] + "/**/*.gemspec").each do |spec| | |
spec = Gem::Specification::load(spec) | |
if spec | |
license_file = spec.homepage.to_s.include?("github") ? spec.homepage + "/master/blob/LICENSE" : '' | |
puts "#{spec.name}, #{spec.version}, #{spec.homepage}, #{spec.license}, #{license_file}" | |
end | |
end | |
# regex for values we care about |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jq = document.createElement('script'); | |
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// ... give time for script to load, then type. | |
jQuery.noConflict(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
String sourceId = '0Q0i00000019TdOCAU'; | |
String destinationId = null; //'0Q0i00000019TdTCAU'; | |
String query = 'select Quoteid, PricebookEntryId, Quantity, UnitPrice, Discount, Description, ServiceDate, ListPrice, Subtotal, TotalPrice '; | |
// get all of the custom, writeable fields | |
Map<String, Schema.SObjectField> fieldMap = QuoteLineItem.getSObjectTypE().getDescribe().fields.getMap(); | |
for (String key : fieldMap.keySet()) { | |
Schema.SObjectField field = fieldMap.get(key); | |
Schema.DescribeFieldResult result = field.getDescribe(); | |
if (result.isCustom() && !result.isCalculated()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP procedure IF EXISTS `ClearSessions`; | |
DELIMITER $$ | |
CREATE PROCEDURE ClearSessions(IN days_ago INT) | |
BEGIN | |
DECLARE bDone INT; | |
DECLARE count INT; | |
DECLARE sessionId INT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.$().select2({ | |
ajax: { | |
url: "/search", | |
type: 'GET', | |
dataType: 'json', | |
delay: 250, | |
data: function (term) { | |
return { | |
q: term, | |
id: params.id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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?) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -maxdepth 1 -type d -ctime +30 -exec rm -rf {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |