Skip to content

Instantly share code, notes, and snippets.

View masterT's full-sized avatar

Simon Thiboutôt masterT

View GitHub Profile
@masterT
masterT / add-jquery.js
Last active August 26, 2015 15:17
Add jQuery
if (typeof jQuery == "undefined") {
console.log("Loading jQuery!");
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js";
document.body.appendChild(script);
} else {
console.log("Let's rock!");
}
@masterT
masterT / README.md
Last active August 29, 2015 14:02
Fix HTML footer

THE FIXER (TEST)

@masterT
masterT / hello_world.pjs
Created June 24, 2014 18:11
My hello_world.pjs file
function sketchProc(processing) {
// Override draw function, by default it will be called 60 times per second
processing.draw = function() {
// determine center and max clock arm length
var centerX = processing.width / 2, centerY = processing.height / 2;
var maxArmLength = Math.min(centerX, centerY);
function drawArm(position, lengthScale, weight) {
processing.strokeWeight(weight);
processing.line(centerX, centerY,
centerX + Math.sin(position * 2 * Math.PI) * lengthScale * maxArmLength,
sfgsefgdfgsdfgs
@masterT
masterT / README.md
Created June 27, 2014 18:06
Functional Test with Selenium

Functional Automatic Tests (with Selenium)

Automatic fonctional tests can be created with the Selenium extension on the browser Firefox. Selenium tests are located in the folder tests/selenium.

You can follow this tutorial to create a new test.

To let time to the jQuery to understand what's going on, add the pause commande , exemple jquery wait for an ajax request to append the results the a form input.

Here is the basic command, it follow the same syntaxe has the selenium log : | command | param1 | param2 | .

# this was surprisingly difficult to find, the documentation and API is poor
require "net/http"
require "uri"
url = URI.parse("http://www.whatismyip.com/automation/n09230945.asp")
req = Net::HTTP::Get.new(url.path)
req.add_field("X-Forwarded-For", "0.0.0.0")
# For content type, you could also use content_type=(type, params={})
@masterT
masterT / issue.rb
Created January 26, 2015 19:12
Issue on phonelib
require 'phonelib'
number = "9549233221"
country = "US"
puts "\nPhonelib.valid_for_country? '#{number}', '#{country}' :"
puts Phonelib.valid_for_country? number, country
@masterT
masterT / cheats.md
Last active August 29, 2015 14:15
CLI Cheats

CLI CHEATS

go to the begin of the line : ctrl-a

go to the end of the line : ctrl-e

delete the line : ctrl-n

@masterT
masterT / resizer.rb
Created April 13, 2015 20:58
Resize an image into an HipChat custom smiley
require 'rmagick'
def resize(file_path)
file = Image.new
@masterT
masterT / database.yml
Created April 14, 2015 17:32
Rails database configuration sample
default: &default
adapter: mysql2
encoding: utf8mb4
username: root
password:
host: 127.0.0.1
port: 3306
development:
<<: *default