Skip to content

Instantly share code, notes, and snippets.

Cerys Williams c3ry5

  • London, United Kingdom
Block or report user

Report or block c3ry5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View countdown.css
body {
background: #000;
}
.countdown {
background: #000;
color: #fff;
display: table;
margin: 0 auto;
text-align: center;
font-family: arial;
@c3ry5
c3ry5 / getVideoId.js
Last active Mar 20, 2016
Regex Map/loop for getting the video id from youtube, vimeo, vine and instagram
View getVideoId.js
getVideoId = {
siteMap : {
"youtube" : {
r : /(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/,
id : 5
},
"vimeo" : {
r : /https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/,
id : 3
},
View helpers.checkUrl.js
var checkUrl = function(url) {
var regex = new RegExp("(https?://(?:www.|(?!www))[^s.]+.[^s]{2,}|www.[^s]+.[^s]{2,})");
return url.match(regex) ? !0 : !1
};
@c3ry5
c3ry5 / combineMediaQueriesAndSelectors.rb
Created Mar 31, 2014
compass callback to restructure css files on stylesheet saved
View combineMediaQueriesAndSelectors.rb
require 'fileutils'
on_stylesheet_saved do |filename|
fileContents = File.read filename
File.open(filename, 'w+') do |f|
mediaQueryObject = {}
regexMedia = /@media([^{]*){((?:(?!}\s*}).)*}.*?)}/xoim
regexSelector = /\s*([^{]*){(.*?)}/xoim
regexSpace = /\n+|\r+/xoim
bodyContents = fileContents.gsub(regexMedia,'')
mediaQueryArray = fileContents.scan(regexMedia)
@c3ry5
c3ry5 / getMediaQuery.css
Created Mar 17, 2014
How to get the media query of your page
View getMediaQuery.css
body #currentMediaQuery {
display: none;
}
@media only screen and max-width 479px {
body #currentMediaQuery {
font-family: xxs;
}
}
View akamai.curl.sh
fileList="
FILE 1 URL
FILE 2 URL
FILE 3 URL
ETC
"
for fileName in $fileList
do
echo "$fileName"
View Capitalize.js
String.prototype.toCapitalize = function() {
return this.toLowerCase().replace(/^\.|\s\S/g, function(a) {
return a.toUpperCase();
});
};
@c3ry5
c3ry5 / eventListener.js
Last active Aug 29, 2015
native js event listener
View eventListener.js
(function () {
'use strict';
var fo = window.fo = window.fo || {},
eventHandler = fo.eventHandler = fo.eventHandler || {};
eventHandler.events = {};
eventHandler.publish = function (event, data) {
var events = event.split(' '),
key, func;
@c3ry5
c3ry5 / mergeObjects.es6.js
Last active Nov 4, 2018
Merging two js objects without jquery
View mergeObjects.es6.js
Object.prototype.assign = Object.assign || function(obj1, obj2) {
var obj3 = obj1;
for (var attrname in obj2) {
if (typeof(obj2[attrname]) !== 'function') {
obj3[attrname] = obj2[attrname];
}
}
return obj3;
@c3ry5
c3ry5 / web.sql.js
Last active Dec 19, 2015
Web sql setup using underscore js
View web.sql.js
(function () {
db = {};
db.map = {
'jobs': {
'create': {
'sql': 'CREATE TABLE "jobs" (id unique, json)'
},
'insert': {
'sql': 'INSERT INTO "jobs" (id, json) VALUES (?,?)'
You can’t perform that action at this time.