Skip to content

Instantly share code, notes, and snippets.

View tcdevs's full-sized avatar

TC Devs tcdevs

  • Technische Centrale
View GitHub Profile
@tcdevs
tcdevs / index.html
Created July 13, 2017 06:46 — forked from seancdavis/index.html
Full-Size, Looping Background Video with YouTube Video
<style>
.bg-video {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
overflow: hidden;
z-index: -1;
}
@tcdevs
tcdevs / .htaccess
Created June 21, 2017 07:59 — forked from nixta/.htaccess
.htaccess to add CORS to your website
# Add these three lines to CORSify your server for everyone.
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"
var gulp = require('gulp'),
path = require('path'),
folder = require('gulp-folders'),
gulpIf = require('gulp-if'),
insert = require('gulp-insert'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
notify = require('gulp-notify'),
rename = require('gulp-rename'),
source_folder = 'source/js',
@tcdevs
tcdevs / show-clicked-row-details-right-way.md
Created April 26, 2017 12:09 — forked from umidjons/show-clicked-row-details-right-way.md
Show clicked row details. Using ng-switch, ng-click, ng-class, ng-repeat, $index.

Show clicked row details. Using ng-if, ng-repeat-start and ng-repeat-end directives

<!doctype html>
<html lang="en-US" ng-app="App">
<head>
	<meta charset="UTF-8">
	<script src="angular.js"></script>
	<title>Users</title>
@tcdevs
tcdevs / Log-.md
Created February 8, 2017 08:14 — forked from bgrins/Log-.md
Prevent errors on console methods when no console present and expose a global 'log' function.

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@tcdevs
tcdevs / simple-javascript-assert.md
Created January 24, 2017 10:30 — forked from asyncanup/simple-javascript-assert.md
Simple JavaScript assert

Why you need assertions

It's better to fail with your own error than undefined is not a function.

A simple assertion solution would let your application fail early and fail at the right point in runtime execution. Allowing you to handle it better.

How you write assertions

@tcdevs
tcdevs / LICENSE.txt
Created January 23, 2017 13:09 — forked from thingsinjars/LICENSE.txt
Chainable DOM Manipulation
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Simon Madine <http://thingsinjars.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tcdevs
tcdevs / Readme.md
Created January 23, 2017 13:04 — forked from williammalo/Readme.md
Chainable DOM Manipulation
@tcdevs
tcdevs / remove-nf-required-fields-string.php
Created January 13, 2017 12:41 — forked from BFTrick/remove-nf-required-fields-string.php
Remove the Ninja Forms required fields string above a form with 1+ required strings.
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_nf_required_fields_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Fields marked with a * are required' :
$translated_text = __( '', 'ninja-forms' );
@tcdevs
tcdevs / 1_primitive_comparison.js
Created January 5, 2017 08:27 — forked from nicbell/1_primitive_comparison.js
JavaScript object deep comparison. Comparing x === y, where x and y are values, return true or false. Comparing x === y, where x and y are objects, returns true if x and y refer to the same object. Otherwise, returns false even if the objects appear identical. Here is a solution to check if two objects are the same.
//Primitive Type Comparison
var a = 1;
var b = 1;
var c = a;
console.log(a == b); //true
console.log(a === b); //true
console.log(a == c); //true
console.log(a === c); //true