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
module.exports = function(grunt) { | |
//1. Configurations | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
coffee: { | |
dist: { | |
files: { | |
'src/js/global.js': 'src/coffee/global.coffee' | |
} |
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 | |
$twitterURL = get_theme_mod('twitter_setting'); | |
$linkedinURL = get_theme_mod('linkined_setting'); | |
$rssURL = get_theme_mod('rss_setting'); | |
$googleURL = get_theme_mod('googleplus_setting'); | |
$facebookURL = get_theme_mod('facebook_setting'); | |
$youTubeURL = get_theme_mod('youtube_setting'); | |
$githubURL = get_theme_mod('github_setting'); | |
$hasAdminLinks = get_theme_mod('adminLinkSetting'); | |
?> |
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 | |
/** | |
* Add Custom theme options | |
*/ | |
class tmosestBlog_Customize { | |
public static function register ( $wp_customize ) { | |
tmosestBlog_Customize::addSocialLinks($wp_customize); | |
tmosestBlog_Customize::addCopyRightText($wp_customize); | |
} |
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
public static void createArray(int n) | |
{ | |
int[] array = new int[n]; | |
} |
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
/** | |
* This time we are create a variable over and over again in a for loop so we see linear space complexity. | |
*/ | |
public static void printMultiplesOfFive(int n) | |
{ | |
for(int i = 1; i <= n; i++) { | |
int multiple = i * 5; | |
System.out.println(multiple); | |
} | |
} |
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
/** | |
* This function has a constant space complexity. | |
* The function call and the variable declaration both take some memory but they don't grow with x. | |
*/ | |
public static int addThree(int x) | |
{ | |
int y = 3; | |
return x + y; | |
} |
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
import android.os.Build; | |
/** | |
* Utility methods related to physical devies and emulators. | |
*/ | |
public class DeviceUtil { | |
public static boolean isEmulator() { | |
return Build.FINGERPRINT.startsWith("generic") | |
|| Build.FINGERPRINT.startsWith("unknown") |
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 isTextInput(node) { | |
return ['INPUT', 'TEXTAREA'].indexOf(node.nodeName) !== -1; | |
} | |
angular.element($document[0]).on('touchstart', function(e) { | |
var activeElement = angular.element($document[0].activeElement)[0]; | |
if(!isTextInput(e.target) && isTextInput(activeElement)) { | |
activeElement.blur(); | |
} | |
}); |
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
// Worste case is n^2 best case is n; | |
public static void BubbleSort(int[] array) | |
{ | |
int j; | |
boolean flag = true; | |
int temp; | |
while(flag) { | |
flag = false; | |
for(j = 0; j < num.lenght - 1; j++) { |
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
// Same worst case and best case | |
public static boolean detectCharacter(String s, char c) | |
{ | |
boolean hasCharacter = false; | |
for(int i = 0; i < s.length(); i++) { | |
if(s.charAt(i) == c) hasCharacter = true; | |
} | |
return hasCharacter; | |
} | |
// Different best case and worse case |
NewerOlder