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
def selection_sort(elements): | |
size = len(elements) | |
# loop over all elements excluding last one | |
for i in range(size - 1): | |
# find the smallest value in current range | |
min_index, min_value = i, elements[i] | |
for j in range(i + 1, size): | |
if elements[j] < min_value: | |
min_index, min_value = j, elements[j] | |
# swap i-th element with the smallest one |
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
alias cdprojects='cd ~/Projects' | |
alias pyc-remove='find . -name "*.pyc" -exec rm -rf {} \;' | |
timestamp2date() { | |
date -d@$1 | |
} | |
alias ts2date=timestamp2date |
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
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-mocks.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-spinner/0.6.1/angular-spinner.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.0.1/spin.js"></script> | |
<script type="text/javascript"> | |
var app = angular.module('myApp', ['ngMockE2E', 'angularSpinner']); |
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"; | |
// run `npm install introspect` before | |
var introspect = require('introspect'); | |
function generateEmail(firstName, lastName, provider) { | |
return firstName + "." + lastName + "@" + provider; | |
} | |
var argMapify = function(fn, argValues, context) { |
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
$(document).ready( function() { | |
$.ajax({ | |
type: "GET", | |
dataType: 'text', | |
async: false, | |
url: "templates.html" | |
}).done(function(response) { | |
$("body").append(response); | |
ich.grabTemplates(); | |
}); |
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
$(document).ready( function() { | |
$('#display').click(function () { | |
var data = [ | |
{ | |
"name": "Paul McCartney", | |
"email": "paul.mccartney@beatles.com", | |
"salary": "400" | |
}, | |
{ | |
"name": "John Lennon", |
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
#!/bin/bash | |
path="src/main/web" | |
> "$path"/templates.ich | |
for file in "$path"/templates/* | |
do | |
cat "$file" >> "$path"/templates.ich |
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
var TemplateLoader = { | |
path: 'templates/', // template files are stored in this directory | |
templates: ['file1', 'file2', 'file3'], // put all your template files here | |
fetchTemplate: function(path) { | |
$.ajax({ | |
type: 'GET', | |
dataType: 'text', | |
async: false, | |
url: path | |
}).done(function(response) { |
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 time | |
start = time.clock() | |
for x in range(1,10000): | |
y = x**3 | |
elapsed = time.clock() - start | |
print elapsed |
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
# define entries | |
entries = [{'type': '+', 'value': 9},\ | |
{'type': '+', 'value': 12.3},\ | |
{'type': '-', 'value': 4},\ | |
{'type': '+', 'value': 0.89},\ | |
{'type': '-', 'value': 2.65},\ | |
{'type': '-', 'value': 14.3},\ | |
{'type': '+', 'value': 6.8},\ | |
{'type': 'unknown', 'value': 200}] |
OlderNewer