View emailcustomencoder.php
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 | |
function tep_rewrite_email($content) { | |
$email_patt = '([A-Za-z0-9._%-]+)\@([A-Za-z0-9._%-]+)\.([A-Za-z0-9._%-]+)'; | |
$mailto_pattern = '#\<a[^>]*?href=\"mailto:\s?' . $email_patt . '[^>]*?\>[^>]*?<\/a\>#'; | |
$rewrite_result = '<span class="mailme">\\1 AT \\2 DOT \\3</span>'; | |
$content = preg_replace($mailto_pattern, $rewrite_result, $content); | |
$content = preg_replace('#' . $email_patt . '#', $rewrite_result, $content); |
View emailpatter.js
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
if (!/\S+@\S+\.\S+/.test("email@example.com")) { | |
// Invalid email address | |
} |
View object.equals.js
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
// Function that compares 2 objects | |
function equals(obj1, obj2, skip) { | |
var i, l; | |
if ( typeof obj1 === "object" && typeof obj2 === "object") { | |
obj1 = JSON.stringify(obj1); | |
obj2 = JSON.stringify(obj2); | |
if (skip && skip.length) { | |
obj1 = JSON.parse(obj1); |
View git.stash
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
# Sometimes we discover that local changes we have made in our GIT project | |
# are not related to the branch we currently work in. | |
# So we need to switch the propoer branch before committing the changes. | |
# 'git stash [, pop]' is going to solve the problem easily. | |
# 1. While you have uncommitted changes, 'stash' them to create a temporary | |
# commit of the current state of the working copy (both cached and | |
# uncached files) and to revert the working copy to the current HEAD: | |
git stash |
View utils.getRandomInteger.js
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
// Returns a random integer between min and max. | |
function getRandomInteger(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} |
View utils.getUNIXTimestamp.js
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
// Returns UNIX timestamp. | |
// Sometimes visible in different JavaScript developers teams as now(). | |
function getUNIXTimestamp() { | |
return Math.round((new Date()).getTime() / 1000); | |
} |
View mac.emptyTrash
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
## | |
# Command to empty Trash with 35-pass security method. This is the most secure deletion, | |
# so you will not be able to recover any file deleted with this method. | |
# Replace <MAC_USER> with your Mac username. | |
## | |
srm -rfv /Users/<MAC_USER>/.Trash/* | |
## | |
# Command to empty Trash with 7-pass security method that meets the |
View webstorm.watchers.handlebars.xml
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
<?xml version="1.0" encoding="UTF-8"?> | |
<TaskOptions> | |
<TaskOptions> | |
/* | |
* Compiled .js files are saved into generated '/compiled' folder. | |
*/ | |
<option name="arguments" value="$FileDir$/$FileName$ -f $FileDir$/compiled/$FileNameWithoutExtension$.js" /> | |
<option name="checkSyntaxErrors" value="false" /> | |
<option name="description" value="Compiles .handlebars, .hbs templates into .js files" /> | |
<option name="exitCodeBehavior" value="ERROR" /> |
View jquery.scrollDirection.js
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
// Variable that is going to hold previous 'document' scrollTop | |
// value (/vertical scrollbars position). | |
var prevScrollTop; | |
// Function that returns 'true' (/boolen) if user scrolls the | |
// page up, 'false' (/boolen) if user scrolls the page down. | |
function scrollsUp(scrollTop) { | |
var before = prevScrollTop; | |
View laravel.controllers.users.php
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 | |
class Users_Controller extends Base_Controller { | |
public function action_index() { | |
$id = Input::get('id'); | |
if ($id) { | |
$user = DB::table('users')->where('id', $id)->first(); | |
OlderNewer