Skip to content

Instantly share code, notes, and snippets.


Ozyr Origame

  • Paris
View GitHub Profile
Origame / resizeTimer.js
Created Oct 25, 2016
Smart resize function
View resizeTimer.js
var resizeTimer;
$(window).on('resize', function(e) {
resizeTimer = setTimeout(function() {
// Run code here, resizing has "stopped"
Origame / tableTransposer.js
Created Oct 25, 2016
Transpose rows & columns in HTML table (for mobile purposes mainly)
View tableTransposer.js
$("table").each(function() {
if ( !$(this).hasClass("reverted") ) {
var $this = $(this);
var newrows = [];
var i = 0;
$(this).find("td, th").each(function(){
if(newrows[i] === undefined) {
newrows[i] = $("<tr></tr>");
Origame / setImgSize.js
Last active Sep 30, 2016
JS function to manage CSS classes to set [width 100%; height auto;] or [height: 100%; width: auto;] on images depending on their natural ratio and their container size
View setImgSize.js
setImgSize: function() {
// Get containers size Height and Width)
var containerH = $('.myContainer').height();
var containerW = $('.myContainer').width();
// Get images natural size and calculate ratio:
// if image is wider than the container, class "wide" sets height to 100% and width to auto
// otherwise, class "tall" sets width to 100% and height to auto
var thisImg = $(this);
Origame / setBoxHeight.js
Created Jul 8, 2016
JS - function to set the same height of items on a row
View setBoxHeight.js
/* Set boxes height to match the highest box on the same row */
setBoxHeight: function(){
var boxes = $j('.myBoxes', this.$scope); //Selector and scope
var boxesByRow = 3; //Nb of items on a row
//Create each row
for(var i = 0; i < boxes.length; i+=boxesByRow) {
var newRow = boxes.slice(i, i+boxesByRow);
Origame / search-regex-for-sublime.js
Created Mar 18, 2016
Search regex for Sublime Text
View search-regex-for-sublime.js
//SEARCH REGEX for sublime Text
//Begins with AA and ends with BB:
//After AA and before BB:
View border-box.css
-ms-box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
Origame / transitions.css
Created Mar 11, 2016
Apply css transition to all with ease
View transitions.css
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
Origame / justify-to-center.css
Created Mar 11, 2016
Horizontally distribute all items
View justify-to-center.css
#subMenu ul{
vertical-align: middle; /*Or anything else*/
width: 100%;
max-width: 960px; /*Allow items to be distributed only in this maximum space, remove if you need all 100% */
margin: 0 auto; /*Center*/
text-align: justify;
#subMenu ul:after{
Origame / verticallyCentered.css
Last active Mar 1, 2016
Vertically centered
View verticallyCentered.css
position: absolute;
top: 50%;
left: 0;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);