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
/** | |
* Convert an hexadecimal value in a integer base-10. | |
* @param hex An hexadecimal value to convert. | |
* @return An integer base-10 equivalent to the given hexadecimal value. | |
*/ | |
function hex2int(hex) { | |
return parseInt(hex, 16); | |
} |
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
/** | |
* Check if a word or phrase is a palindrome in 106 characters of JavaScript. | |
*/ | |
function isPalindrome(s) { | |
return s.match(/[a-zA-Z]/g).join('').toLowerCase()==s.match(/[a-zA-Z]/g).reverse().join('').toLowerCase(); | |
} |
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
/// <summary> | |
/// Return the expression text | |
/// </summary> | |
/// <typeparam name="TModel"></typeparam> | |
/// <param name="expression"></param> | |
/// <returns></returns> | |
public static string GetExpressionText<TModel>(Expression<Func<TModel, object>> expression) | |
{ | |
var expr = (LambdaExpression)expression; | |
if (expr.Body.NodeType == ExpressionType.Convert) |
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 (var i = 0; i < list.Count; i++) | |
{ | |
var first = i == 0; | |
var last = i == list.Count - 1; | |
var current = i + 1; | |
var previous = i; | |
if (first || previous % 3 == 0) | |
{ | |
@Html.Raw("<div class=\"row\">"); |
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
/// <summary> | |
/// Return the full name of an entity. | |
/// </summary> | |
public String FullName() | |
{ | |
get | |
{ | |
return String.Join(" ", new String[] { this.FirstName, this.MiddleName, this.LastName, this.SecondLastName }); | |
} | |
} |
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
{ | |
"color_scheme": "Packages/Color Scheme - Default/Cobalt.tmTheme", | |
"detect_slow_plugins": false, | |
"dictionary": "Packages/Language - English/en_US.dic", | |
"font_size": 11, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"ignored_words": |
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
button { | |
border: 1px solid rgba(0, 0, 0, 0.25); | |
border-radius: 2px; | |
color: #444; | |
margin: 0px 5px; | |
min-height: 29px; | |
min-width: 65px; | |
-webkit-user-select: none; | |
padding: 8px 13px; | |
/* iOS does not support linear-gradient without a prefix. */ |
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
<snippet> | |
<content><![CDATA[ | |
Event::listen('illuminate.query', function($sql) {dd($sql);}); | |
]]></content> | |
<tabTrigger>sql</tabTrigger> | |
<scope>source.php</scope> | |
</snippet> |
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
clear | |
curdir="${0%/*}" | |
uglifyjs -v \ | |
$curdir/jquery/jquery.js \ | |
$curdir/twbs/js/bootstrap.js \ | |
$curdir/superfish/superfish.js \ | |
$curdir/site/js/site.js \ | |
-o $curdir/../../js/app.js \ | |
-m | |
echo 'JS files compiled successfully!' |
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
<?php | |
use Carbon\Carbon; | |
use Illuminate\Validation\Validator; | |
class CustomValidator extends Validator { | |
# carbon_date_format # | |
public function validateCarbonDateFormat($attribute, $value, $parameters) |
OlderNewer