// A lock has a three pin combination to unlock it. A program to list all possible combinations
(function() {
var i = 0,
j = 0,
k = 0;
var max = 9;
for (i; i <= max; i++) {
for (j = i; j <= max; j++) {
for (k = j; k <= max; k++) {
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
// <script src="https://apis.google.com/js/client:platform.js" type="text/javascript"></script> | |
var app = angular.module("MyApp", []); | |
app.service('GoogleService', ['$q', '$http', '$log', '$window', function($q, $http, $log, $window){ | |
var gapi = $window.gapi; | |
var updateSigninStatus = function(isSignedIn) { | |
if (isSignedIn) { | |
makeApiCall(); | |
} |
// Set image as background of a div element using CSS
.fill-bg {
background-img: url('MYURLHERE');
background-size : 'cover';
background-repeat : 'no-repeat';
background-position : 'center center';
}
/* Automate the above process using jquery, so that
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
<!DOCTYPE html> | |
<html ng-app="app"> | |
<head> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.1/angular.min.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body ng-controller="MyCtrl"> | |
{{serviceOutput}} | |
<br/><br/> |
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 myApp = angular.module('myApp', []); | |
// a simple service | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" | |
}; | |
}); | |
// a simple factory |
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
#!/usr/bin/python | |
# Usage: python rename_files.py "C:\Directory of Files with Underscores" | |
import os | |
import sys | |
directory = sys.argv[1] # parse through file list in the current directory | |
for filename in os.listdir(directory): # parse through file list in the current directory |
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
# !/bin/bash | |
# author: Robert Mark Bram | |
# link: http://robertmarkbramprogrammer.blogspot.se/2007/06/cygwin-bash-script-open-windows.html | |
usage () | |
{ | |
echo "Open Windows Explorer" | |
echo "Usage: $0 [-help] [path]" | |
echo " [path]: folder at which to open Windows Explorer, will" | |
echo " default to current dir if not supplied." |
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
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
public class ReadInput { | |
public static void main(String[] args)throws IOException { | |
int age = 0; | |
boolean married = false; | |
String gender = null; |