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); | |
} |
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(); | |
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 localStorage (or its particular key) allocated memory | |
* in Megabytes (MB). | |
* @param {string=} opt_key inside the storage to calculate | |
* used space for. | |
* @return {number} with 2 decimal points. | |
*/ | |
function getLocalStorageUsedSpace(opt_key) { | |
var allocatedMemory = 0, | |
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 sendToNative(data: string) { | |
if (/android/i.test(window.navigator.userAgent)) { | |
if (window.quicketNative) { | |
return window.quicketNative.send(data); | |
} | |
} | |
let frame = document.createElement('iframe'); | |
frame.width = '100'; |
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 |
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; | |
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
/** | |
* Takes a style object and returns the corresponding | |
* attribute value. Converts camel case property names | |
* to proper CSS selector names. | |
* @param {Object} obj Map of CSS properties to values. | |
* @return {string} The style attribute value. | |
*/ | |
function toStyleAttribute = function(obj) { | |
return Object.keys(obj).map(function(key) { | |
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
'use strict'; | |
var Promise = require('promise'); | |
/** @desc A function that returns a promise with an error-prone code. */ | |
function build() { | |
return new Promise(function(fulfill, reject) { | |
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" /> |
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
--strict | |
--jsdoc | |
--summary | |
--beep | |
--check_html | |
--nomultiprocess | |
--debug_indentation | |
--time |