Skip to content

Instantly share code, notes, and snippets.

Bertrand Chardon Veejay

Block or report user

Report or block Veejay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Veejay
Veejay / proxy.js
Last active Nov 7, 2017
Object extension
View proxy.js
const wrap = (object) => {
return new Proxy(object, {
get(target, property, receiver) {
switch (property) {
case 'store':
return (...args) => {
return Reflect.set(object, ...args)
}
break
case 'fetch':
@Veejay
Veejay / wat_extractor.rb
Created Jul 19, 2016
Extracts generator meta information from WAT files
View wat_extractor.rb
require 'json'
class WatExtractor
attr_reader :file
def initialize file_name
@file = File.new file_name
end
def target_uri? line
line =~ /\AWARC-Target-URI:/
View git-offshoot.markdown

Description

Command git-offshoot allows the user to create a git branch, in a similar fashion to built-in git checkout -b.
It also creates an initial commit on that branch and stores the name of the "parent" branch in a file called PARENT.

Usage

git offshoot <branch-name>
View widget.markdown
widget.height = file.height;
widget.width = file.width;

widget.image_url = file.image_url;
widget.imageTooSmall = widget.width < pi_editor.imgWidth(widget.span))
pi_editor.setBestAvailableFormat(widget);

Variables utilisées

@Veejay
Veejay / sugar.js
Last active Aug 29, 2015
Two functions on Object.prototype
View sugar.js
Object.prototype.values = function() {
return Object.getOwnPropertyNames(this).reduce(function(values, property) {
values.push(this[property]);
return values;
}.bind(this), []);
};
Object.prototype.forEach = function(callback) {
Object.keys(this).forEach(function(key) {
callback.call([], key, this[key]);
@Veejay
Veejay / link_checker.go
Created Jan 24, 2014
Link fetcher/checker
View link_checker.go
@Veejay
Veejay / create_website.markdown
Last active Jan 3, 2016
Comment créer un site internet visible
View create_website.markdown

How to create a visible Internet website?

  1. You're at home and you feel like buying a book. Like more and more people these days, you take to your computer and in the Google Internet search bar, you type in your query:

Example : "Buy Bilbo the Hobbit Tolkien"

  1. The words in that query represent the keywords that define your expectations. All of a website's SEO problematics are encompassed in this simple scenario.

In this guide, we'll present you with the keys to success on the path to creating a professional website.

@Veejay
Veejay / cors.markdown
Last active Jan 31, 2018
Working around Javascript Canvas API CORS limitations
View cors.markdown

The problem

Manipulating images through the Javascript Canvas API is great. It allows the developer to apply powerful transformations to an image before displaying it on a web page. Despites its power, the Canvas API also has a limitation that can be extremely annoying: not respecting CORS "taints" the canvas, which severely ampers its most basic uses (see the MDN article about it)

An example of the problem

I have the URI to a Flickr photo (say the picture of a friend for example) and I want to apply a given transformation to the image before displaying it on my webpage. Two choices then:

  1. Cropping the image myself with some random Adobe tool or Picasa / Aviary / whatever
  2. Using the canvas API to do it on the fly in web page
@Veejay
Veejay / deploy.txt
Created Jan 9, 2014
Deploy DotCloud
View deploy.txt
11:44:54.690309: [www.1] Waiting for the instance to become responsive...
11:44:55.690412: [www.1] Re-routing traffic to the new build...
11:44:57.879748: [www.1] Successfully installed build revision git-ca27db9 for service (www) instance #1
11:44:57.891125: [www.1] Installation successful for service (www) instance #1
######## 32 minutes later #############
....12:16:49.384984: [www.0] Running postinstall script...
12:16:53.852343: [www.0] Launching...
12:16:57.930708: [www.0] Waiting for the instance to become responsive...
@Veejay
Veejay / editor.markdown
Created Sep 28, 2013
An idea for a modern editor
View editor.markdown

The modern editor

An idea to change the way we interact with files in 2013 and beyond.

At the beginning of the Internets, there was HTML.

Using a limited set of tags, people were able to create webpages by assembling the bricks using, let's be honest, a shitload of tables for layout purposes.

Though looking back on it now seems like the dark ages (and is nowadays loudly frowned upon), it didn't prevent a whole new world from being created.

You can’t perform that action at this time.