View wrapper.function.js
var a = function() { console.log("function a"); };
var wrapper = function(func) {
return function() {
return func(args);
}
};
wrapper(a);
View autoappender.php
<?php
// The PHP version of AutoAppender.js,
// @author Daniel Haim
// @url https://codepen.io/danielhaim1/pen/pwXJLp?editors=1010
class Page {
public $header = array();
public $sections = array();
View file_exists_function.php
<?php
$path = 'the/file/path.jpg';
if (@fopen($path,"r")==true){
echo 'it exists '
}
else { }
?>
View countwords.js
$(document).ready(function($) {
function countWords(tx){
return tx?tx.replace(/ +/g," ").replace(/\w+| $|^ /g,"").length+1:0;
}
$textarea = $(".avca-form textarea");
$textarea.keyup(function(e){
$(".textcount").text($textarea.countWords());
});
View responsive-layouts.scss
// Margin and Padding
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
@each $prop, $abbrev in (margin: m, padding: p) {
@each $size, $lengths in $spacers {
$length-x: map-get($lengths, x);
$length-y: map-get($lengths, y);
View app.js
import 'classlist-polyfill';
import Promise from 'bluebird';
import Markdown from 'markdown';
const md = Markdown.markdown.toHTML;
import workText from 'raw!./work.txt';
import pgpText from 'raw!./pgp.txt';
import headerHTML from 'raw!./header.html';
let styleText = [0, 1, 2, 3].map(function(i) { return require('raw!./styles' + i + '.css'); });
import preStyles from 'raw!./prestyles.css';
import replaceURLs from './lib/replaceURLs';
View get_client_ip.php
<?php
function get_client_ip() {
$ipaddress = '';
if (isset($_SERVER['HTTP_CLIENT_IP']))
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_X_FORWARDED']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
View iframeautoheight.js
var buffer = 20; //scroll bar buffer
var iframe = document.getElementById('ifm');
function pageY(elem) {
return elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop;
}
function resizeIframe() {
var height = document.documentElement.clientHeight;
height -= pageY(document.getElementById('ifm'))+ buffer ;
View color-harmony.scss
//Pick a color
$first-color: hsl(10, 100%, 50%);
// Find the complement
$second-color: complement($first-color);
//Check if you have a cool color on your hands. Cool colors will overpower warm colors when mixing.
View Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compressed',
sourceMap: false
},