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
class SkuProfilesController { | |
def skuProfileService | |
def show() { | |
paramsSplit(['ids', 'fields']) | |
def cmd = bindData(new ListSkuProfilesCommand(), params) | |
if (!cmd.validate()) { | |
throw new EntityValidationException(cmd.errors) | |
} |
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
/* Why HQL? | |
Cause: | |
* Criteria + projections + join = "joins are ignored" | |
* Criteria + projections + forced join = "joins not ignored but joined tables are fetched lazy" | |
* HQL do not need explicit join clauses; joins are inferred automatically for one-to-one & many-to-one associations | |
* GORM criteria is buggy | |
*/ |
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
{ | |
"color_scheme": "Packages/User/Solarized (Dark) (SL).tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"save_on_focus_lost": true, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, |
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
[ | |
{ "keys": ["super+shift+k"], "command": "reveal_in_side_bar"} | |
] |
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
grailsClass.metaClass.withOptimisticLocking = { Long timeout = 3000L, Closure cls -> | |
def startTime = new Date().time | |
def duration = 0 | |
def attempts = 0 | |
while (true) { | |
try { | |
attempts++ | |
cls.call() | |
break | |
} catch (OptimisticLockingFailureException e) { |
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
# Chai assert extensions | |
### | |
Check an object is rendered. | |
Expects @_obj to be a jQuery object. | |
### | |
chai.Assertion.addProperty 'rendered', -> | |
selector = @_obj.selector | |
@assert @_obj.length > 0 | |
, "expected #{selector} is not rendered" |
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
loadScript = (src, callback) -> | |
script = document.createElement("script") | |
loaded = undefined | |
script.setAttribute "type", "text/javascript" | |
script.setAttribute "src", src | |
if script.readyState | |
script.onreadystatechange = -> # For old versions of IE | |
callback() if @readyState is "complete" or @readyState is "loaded" | |
return | |
else # Other browsers |
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
public class CrackingTheCode1 { | |
public static void main(String[] args) { | |
CrackingTheCode1 app = new CrackingTheCode1(); | |
String[] tests = new String[] { | |
"abc123", "abc12a", "abc122", "s3cr3t0", "!#%&/()", "#abc123#" | |
}; | |
for (int i = 0; i < tests.length; i++) { | |
String s = tests[i]; | |
System.out.printf("%s : %b\n", s, app.isUniqueChars(s)); | |
} |
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 isBalanced = function(str) { | |
var openers = '{[(<'; | |
var closers = '}])>'; | |
var stack = []; | |
str = str.split(''); | |
for (var i = 0; str.length; i++) { | |
var index; | |
if (openers.indexOf(str[i]) != -1) stack.push(str[i]); | |
else if ((index = closers.indexOf(str[i])) != -1) { |
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 isConsecutiveArray = function(numbers) { | |
var min = numbers[0], | |
max = numbers[0] | |
n = numbers.length; | |
for (var i = 1; i < n; i++) { | |
if (numbers[i] < min) min = numbers[i]; | |
if (numbers[i] > max) max = numbers[i]; | |
} | |
OlderNewer