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
| package main | |
| import "code.google.com/p/go-tour/pic" | |
| func Pic(dx, dy int) [][]uint8 { | |
| picData := make([][]uint8, dy) | |
| for y := range picData { | |
| picData[y] = make([]uint8, dx) |
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
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| const( | |
| ACCURACY_DELTA = 0.00000000000001 // Experiment with this value to see accuracy impact! | |
| ) |
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
| { | |
| "Statement": [ | |
| { | |
| "Sid": "PackerSecurityGroupAccess", | |
| "Action": [ | |
| "ec2:CreateSecurityGroup", | |
| "ec2:DeleteSecurityGroup", | |
| "ec2:DescribeSecurityGroups", | |
| "ec2:AuthorizeSecurityGroupIngress", | |
| "ec2:RevokeSecurityGroupIngress" |
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
| var issue = 'solve this mess'; | |
| var secretArgueTime = Math.floor(Math.random()*86400000); // If only it didn't actually boil down to this | |
| filibuster = setInterval(function(){ | |
| console.log('We must '+issue); | |
| },500); | |
| opposition = setInterval(function(){ | |
| console.log('Never!'); | |
| },500); |
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
| mergeObjects: function(){ | |
| var mergedObj = {}; | |
| for (var i = 0, max=arguments.length; i !== max; i++) { | |
| var obj = arguments[i]; | |
| for (var key in obj) { | |
| if( obj.hasOwnProperty(key) ) { | |
| if( mergedObj[key] ) { | |
| mergedObj[key] += obj[key] | |
| } | |
| else { |
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
| if (!in_array(strtolower($input), array('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'))){ | |
| return false; | |
| //or throw an exception | |
| } |
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
| // array_unique is WAY TOO SLOW! This method is significantly faster. | |
| array_flip(array_flip($arr)); | |
| // If you need new keys generated use array_keys | |
| array_keys(array_flip($arr)); |
NewerOlder