Skip to content

Instantly share code, notes, and snippets.

@aderaaij
aderaaij / .eslintrc
Last active October 6, 2017 13:37
React ESLINT config
{
"env": {
"node": true,
"browser": true,
"es6": true
},
"extends": "airbnb-base",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
{
"env": {
"node": true,
"browser": true,
"es6": true
},
"extends": "airbnb-base",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@aderaaij
aderaaij / offset.js
Created November 29, 2015 18:17
Basic offset function, replacing jQuery's offset.
function offset(elt) {
var rect = elt.getBoundingClientRect(), bodyElt = document.body;
return {
top: rect.top + bodyElt .scrollTop,
left: rect.left + bodyElt .scrollLeft
}
}
//use:
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function() {
@aderaaij
aderaaij / ajaxify.js
Last active November 12, 2017 15:34
ajaxify some stuff
// Ajaxify internal content
(function (window, undefined) {
// Prepare our Variables
var
History = window.History,
$ = window.jQuery,
document = window.document;
// Check to see if History.js is enabled for our Browser
(function(DOMParser) {
"use strict";
var
DOMParser_proto = DOMParser.prototype
, real_parseFromString = DOMParser_proto.parseFromString
;
// Firefox/Opera/IE throw errors on unsupported types
try {
@aderaaij
aderaaij / background-image.haml
Created September 4, 2014 08:43
inline styles in variable image
.foo{:style => "background-image: url('#{current_page.data.imageurl}');"}
@aderaaij
aderaaij / thumbnails.php
Last active November 12, 2017 15:35
Post thumbnail support
<?php
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 150, 150, true );
add_image_size( 'thumb-585_320', 585, 320, true);
add_image_size( 'thumb-1920_1080', 1920, 1080, true);
}
@aderaaij
aderaaij / setup.php
Last active November 12, 2017 15:35
Functions setup
<?php
if ( ! isset( $content_width ) )
$content_width = 674; /* pixels */
if ( ! function_exists( 'oms_setup' ) ):
function oms_setup() {