This file contains hidden or 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
SELECT l.*,a.* | |
FROM pg_locks l | |
JOIN pg_stat_activity a USING (pid) | |
WHERE NOT granted; |
This file contains hidden or 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
require 'benchmark/ips' | |
GC.disable | |
Benchmark.ips do |x| | |
x.report("double_quotes") { "a" } | |
x.report("single_quotes") { 'a' } | |
x.compare! | |
end |
This file contains hidden or 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
angular.module('CustomFilter', []). | |
filter('capitalize', function() { | |
return function(input, all) { | |
var reg = (all) ? /([^\W_]+[^\s-]*) */g : /([^\W_]+[^\s-]*)/; | |
return (!!input) ? input.replace(reg, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}) : ''; | |
} | |
}); | |
function Ctrl($scope) { | |
$scope.msg = 'hello, world.'; |
This file contains hidden or 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
<?php | |
// This will convert a iOS HealthKit Data Export startDate or endDate (NSDate format) | |
// into a DateTime Object for use in PHP | |
// Written by Chris Kacerguis | |
$nsdate = '20150802105200-0500'; | |
$format = 'YmdHis-O'; | |
$objDateTime = DateTime::createFromFormat('YmdHis', (int) $time); | |
$human_readable = $objDateTime->format('F d, Y h:ia'); | |
$unix_timestamp = $objDateTime->format('U'); |
This file contains hidden or 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
-Xms128m | |
-Xmx2048m | |
-XX:MaxPermSize=350m | |
-XX:ReservedCodeCacheSize=64m | |
-XX:+UseCodeCacheFlushing | |
-XX:+UseCompressedOops |
This file contains hidden or 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
require 'aws-sdk' | |
ec2 = AWS::EC2.new( | |
:access_key_id => 'AWS_ACCESS_KEY', | |
:secret_access_key => 'AWS_SECRET_KEY') | |
i = ec2.instances["INSTANCE_ID"] | |
puts i.public_ip_address | |
puts i.private_ip_address |
This file contains hidden or 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
require 'aws-sdk' | |
require 'net/http' | |
ec2 = AWS::EC2.new( | |
:access_key_id => 'YOUR_ACCESS_KEY_ID', | |
:secret_access_key => 'YOUR_SECRET_ACCESS_KEY') | |
# Create our VM | |
instance = ec2.instances.create( | |
:image_id => 'ami-9eaa1cf6', |
This file contains hidden or 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
# Written by Chris Kacerguis | |
# AWS Credentials | |
ec2 = AWS::EC2.new( | |
:access_key_id => 'YOUR_ACCESS_KEY_ID', | |
:secret_access_key => 'YOUR_SECRET_ACCESS_KEY') | |
secgrp = ec2.security_groups.create('NAME_OF_SECURITY_GROUP') | |
# EXAMPLE: single port | |
secgrp.authorize_ingress(:tcp, 80) |
This file contains hidden or 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
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
require APPPATH.'/libraries/REST_Controller.php'; | |
/** | |
* Class API_Sample | |
*/ | |
class API_Sample extends REST_Controller | |
{ |
This file contains hidden or 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 goes in ~/.bash_profile (adjust PHP to your version) | |
export PATH=/Applications/MAMP/bin/php/php5.4.25/bin:$PATH |