Skip to content

Instantly share code, notes, and snippets.

View scsskid's full-sized avatar
:octocat:

Benedikt Gregor scsskid

:octocat:
View GitHub Profile
@sineld
sineld / laravel-upload-resize.php
Created September 25, 2012 08:11
Laravel File Upload And Resize
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);
@mirisuzanne
mirisuzanne / type.scss
Created September 2, 2012 17:24
Using modular scale with vertical rhythms
// Using the Modular Scale plugin along with Compass Vertical Rhythms module.
// The goal is to use MS to give us the values,
// and use VR to apply those values to our typography.
// ---------------------------------------------------------------------------
// Defaults
$base-size: 24px;
$ratio: major-third() fifth();
@tylerbuchea
tylerbuchea / optimizedScroll.js
Created July 29, 2015 22:39
The JavaScript scroll event isn't very peformant this MDN snippet fixes that with a modified event.
(function() {
'use strict';
var throttle = function(type, name, obj) {
obj = obj || window;
var running = false;
var func = function() {
if (running) { return; }
running = true;
obj.requestAnimationFrame(function() {
obj.dispatchEvent(new CustomEvent(name));
@nmec
nmec / gulp-modernizr.js
Last active January 31, 2019 17:15
A very simple gulp task for compiling a custom modernizr build.
'use strict';
var fs = require('fs');
var gulp = require( 'gulp' );
var modernizr = require('modernizr');
var config = require('./modernizr-config'); // path to JSON config
gulp.task( 'modernizr', function (done) {
modernizr.build(config, function(code) {
@just-boris
just-boris / index.js
Last active April 10, 2019 20:59
Gulp wrap pipe
/**
* Wrap gulp streams into fail-safe function for better error reporting
* Usage:
* gulp.task('less', wrapPipe(function(success, error) {
* return gulp.src('less/*.less')
* .pipe(less().on('error', error))
* .pipe(gulp.dest('app/css'));
* }));
*/
var keepsHisWord;
keepsHisWord = true;
promise1 = new Promise(function(resolve, reject) {
if (keepsHisWord) {
resolve("The man likes to keep his word");
} else {
reject("The man doesnt want to keep his word");
}
});
console.log(promise1);
@razwan
razwan / _baseline.scss
Created April 14, 2014 16:20
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
@bob-lee
bob-lee / polyfill-ie11-nodelist-foreach.js
Created November 24, 2017 18:41
Polyfill for IE11 missing NodeList.forEach
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
@bastianallgeier
bastianallgeier / statify.php
Last active October 4, 2022 17:12
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@Dimasmagadan
Dimasmagadan / WP_Query.php
Last active November 21, 2022 06:27 — forked from luetkemj/wp-query-ref.php
#WordPress query with args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
//////Author Parameters - Show posts associated with certain author.