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 | |
import sys, re, os | |
SCAN_EXTENSIONS = ["js", "html", "php", "py", "rb"] | |
def error_in_line(line): | |
return True if re.search(",}", line) else False# Check inside a line | |
def search_file(filename): | |
try: |
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
// Parent class with two properties, one integer and one object | |
var ParentClass = function() { | |
this.counter = 0; | |
this.obj = { counter : 0 }; | |
this.inca = function() { | |
this.counter++; | |
this.obj.counter++; | |
} | |
}; |
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
#include <iostream> | |
void tree(int d, int n); | |
long long int found = 0; | |
int target = 1000000; | |
void tree(int d, int n) { | |
if(d > target) | |
return; | |
found += 1; |
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
from math import sqrt | |
d = pow(10, 6) | |
factors = [-1, -1] | |
primes = [] | |
def phi(i): | |
res = 1 | |
index = 0 | |
while index < len(factors[i]): |
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
#include <stdio.h> | |
#define ROWS 1001 | |
int main() { | |
int levels; | |
int sum = 0; | |
int corner = 1; | |
int row_length = 2; | |
for(levels = 0; levels < ROWS/2; ++levels) { | |
sum += (2*corner + row_length*3)*2; |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
// Javascript minification | |
min : { | |
code : { | |
'src' : [ | |
'public/js/file1.js', | |
'public/js/file2.js', | |
'public/js/file3.js' | |
], |
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
// Create an empty canvas | |
var canvas = document.createElement('canvas'); | |
// Create an image | |
var img = new Image(); | |
img.src = "http://path/to/image.png"; | |
// Wait for image to be downloaded | |
img.onload = function() { | |
// Draw the image on the canvas |
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
describe("My module", function() { | |
it("answers to myMethod() correctly", function() { | |
var instance = new MyModule(); | |
expect(instance.myMethod()).toEqual("Hello world"); | |
}); | |
}); |
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
watch: { | |
js: { | |
files: [ | |
'public/javascripts/src/**/*.js', | |
'public/javascripts/spec/**/*.js' | |
], | |
tasks: ['jasmine:all'] | |
} | |
} |
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
istanbul: { | |
src: '<%= jasmine.all.src %>', | |
options: { | |
vendor: '<%= jasmine.all.options.vendor %>', | |
specs: '<%= jasmine.all.options.specs %>', | |
template: require('grunt-template-jasmine-istanbul'), | |
templateOptions: { | |
coverage: 'coverage/json/coverage.json', | |
report: [ | |
{type: 'html', options: {dir: 'coverage/html'}}, |
OlderNewer