Skip to content

Instantly share code, notes, and snippets.

@frozonfreak
frozonfreak / app.js
Created July 5, 2013 06:04
Check if user is online AngularJS
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});
app.run(function($window, $rootScope) {
$rootScope.online = navigator.onLine;
$window.addEventListener("offline", function () {
$rootScope.$apply(function() {
@frozonfreak
frozonfreak / largecsvexcelimport
Created July 19, 2013 08:17
import large csv into excel Directions You need to add the code to a module in your workbook. If you run the code you will be shown an Input box which will allow you to select the file you want. It imports your text and if it reaches the row 65536 it creates a new worksheet.
Sub ImportBigText()
Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
FileName = InputBox("Please enter the Text File's name, e.g. test.txt")
'If Error Then End
If FileName = "" Then End
FileNum = FreeFile()
Open FileName For Input As #FileNum
@frozonfreak
frozonfreak / index.haml
Created July 23, 2013 03:26
A CodePen by Joacim Nilsson. Loading animation - This is just a simple loading animation based on 10 p tags just looping the exact same animation but with different delays.
#loading
- (1..10).each do
%p
@frozonfreak
frozonfreak / index.html
Created July 23, 2013 03:28
A CodePen by Billy Crist. Switches - The first 2 are designed with depth and lighting, while the 3rd one is flatly designed with a somewhat "gooey"-ish transition on it.
<div class="wrap">
<input type="checkbox" id="s1" />
<label class="slider-v1" for="s1"></label>
<input type="checkbox" id="s2" checked="" />
<label class="slider-v1" for="s2"></label>
</div><!--/wrap-->
<div class="wrap">
@frozonfreak
frozonfreak / index.html
Created August 6, 2013 05:20
CDN fallback script for CSS
<script type="text/javascript">
$.each(document.styleSheets, function(i,sheet){
if(sheet.href=='http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css') {
var rules = sheet.rules ? sheet.rules : sheet.cssRules;
if (rules.length == 0) {
$('<link rel="stylesheet" type="text/css" href="path/to/local/jquery.mobile-1.0b3.min.css" />').appendTo('head');
}
}
})
</script>
@frozonfreak
frozonfreak / style.css
Created August 29, 2013 03:37
CSS Reset
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
@frozonfreak
frozonfreak / php_pdo_connection_check.php
Last active December 22, 2015 19:19
php pdo db connection check
try{
$db = new PDO(DB_STRING, DB_USER, DB_PASSWORD,
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$response = array("status" => 1,"message"=> "DB Connection Succesfull");
die(json_encode($response));
}
catch(PDOException $ex){
$response = array("status" => 0,"message"=> "DB Connection Failed");
die(json_encode($response));
}
# 5G BLACKLIST/FIREWALL (2013)
# @ http://perishablepress.com/5g-blacklist-2013/
# 5G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR]
@frozonfreak
frozonfreak / index.html
Created October 11, 2013 02:39
CSS Gradient Animation from Source http://trentwalton.com/bgclip/ Browser : Safar and Chrome
<div id="container">
<div class="content">
<div class= "masked">
<h1>Selectable Text</h1>
</div>
</div>
</div>
@frozonfreak
frozonfreak / paper.css
Created December 3, 2013 03:57
Print and PDF alignment
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>