View integers.json
### data/integers.json | |
{ | |
"100": { "value": true } | |
} |
View find-unused-sass-variables.sh
#!/usr/bin/env bash | |
## Usage | |
# 1. Run chmod +x ./lib/unused.sh to give execute permission to your script. | |
# 2. Run ./lib/unused.sh ./src/scss | |
if [ -z "$1" ]; then | |
echo "Please specify a directory as the first argument." | |
exit 1 |
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 ; |
NewerOlder