Skip to content

Instantly share code, notes, and snippets.

View manuhabitela's full-sized avatar
🦆

Emmanuel Pelletier manuhabitela

🦆
View GitHub Profile
@manuhabitela
manuhabitela / help_for_word_devdocs.py
Last active December 20, 2015 05:49
Sublime Text 2/3 "help_for_word" command: view docs about the current word on devdocs.io if available, google otherwise
# search for the keyword under the scope on devdocs.io or google if language is not supposedly supported
#
# how to use: bind the "help_for_word" command to a keyboard shortcut
# put your cursor on the language keyword, function, ... you want info on
# trigger the command via the shortcut > devdocs or google is opened on your browser
#
# code is mostly http://dom111.co.uk/files/sublime/plugins/help_for_word.py
# modified to use devdocs.io as the main doc website
import sublime
import sublime_plugin
@manuhabitela
manuhabitela / position.scss
Last active December 23, 2015 10:19
Sass position mixin that uses transforms (translateX/translateY) when available
/** Sass mixins to position stuff with transforms when they're available with Modernizr and with usual position values otherwise
*
* instead of writing `bottom: 7px`, just write `@include bottom(7px)`
**/
@mixin __position($pos, $value) {
html.no-csstransforms & {
#{$pos}: $value;
}
html.csstransforms & {
@if $pos == right or $pos == bottom {
@manuhabitela
manuhabitela / AppController.php
Created October 9, 2013 16:54
CakePHP + Steam OpenID : beginning of some code that will probably never be finished.
<?php
App::uses('Controller', 'Controller');
class AppController extends Controller {
public $components = array(
'Auth' => array(
'authenticate' => array(
'FormValue' => array(
'field' => 'steam_id',
'userModel' => 'User'
@manuhabitela
manuhabitela / casper-conf.js
Created November 13, 2013 20:09
basic casperjs conf
var casper = require('casper').create({
verbose: true,
logLevel: "debug",
viewportSize: { width: 1378, height: 768 }, //for real, my screen is like everyone else's!
pageSettings: {
loadImages: false,
loadPlugins: false,
//I'm using Chrome, I SWEAR
userAgent: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"
},
@manuhabitela
manuhabitela / webplatformdaily.css
Last active December 31, 2015 12:19
Open Web Platform Daily Digest custom stylesheet: focus on content. Easily usable with Stylebot and others.
article {
border: none;
margin: 0 auto;
padding: 0;
}
.banner, .quotes, h1, .patron-count {
display: none;
}
@manuhabitela
manuhabitela / create-drawing.php
Last active November 26, 2020 11:08
DrawingBoard: let people draw and save their images server-side https://github.com/Leimi/drawingboard.js
<?php
//server-side code where we save the given drawing in a PNG file
$img = filter_input(INPUT_POST, 'image', FILTER_SANITIZE_URL);
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
//see http://j-query.blogspot.fr/2011/02/save-base64-encoded-canvas-image-to-png.html
$img = str_replace(' ', '+', str_replace('data:image/png;base64,', '', $img));
$data = base64_decode($img);
@manuhabitela
manuhabitela / _tabs.scss
Last active August 29, 2015 14:00
Simple JS tabs with Backbone
.Tabs-tabs {
@extend .u-inlineList;
}
.Tabs-tab {
}
.Tabs-link {
&:hover,
@manuhabitela
manuhabitela / bootstrap-breakpoint-indicator-bookmarklet.js
Last active December 2, 2015 07:52
Bookmarklet showing current bootstrap breakpoint at the top left of the page
(function(){
var script = document.createElement("script");
script.src = "https://rawgit.com/Leimi/122905f66682fb3c4927/raw/source.js";
document.getElementsByTagName("head")[0].appendChild(script);
})();
#!/usr/bin/env python
#-------------------------------------------------
# file: twitcher.py
# author: Florian Ehmke
# description: dmenu for twitch streams
#-------------------------------------------------
import argparse
import requests
from subprocess import Popen, PIPE, STDOUT
@manuhabitela
manuhabitela / compile.js
Last active September 4, 2019 08:51
Checking environment in (node) Sass
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var sass = require('node-sass');
var ENV = process.env.SASS_ENV || 'development';
var file = 'variables.scss';
//if in dev, directly pass file to sass
if (ENV === "development") {