Skip to content

Instantly share code, notes, and snippets.

View steffanwilliams's full-sized avatar

Steffan Williams steffanwilliams

View GitHub Profile
@steffanwilliams
steffanwilliams / setCharacters.js
Created June 21, 2020 12:40
Figma helper to keep styling when setting characters
const fd = require('fast-diff');
const getFontRanges = (node) => {
let fonts = [];
function searchCharacters(string, index) {
let font = node.getRangeFontName(index, index + string.length);
if (typeof font === 'object') {
let found = fonts.find(range => JSON.stringify(range.font) === JSON.stringify(font));
/*
1. Change the addEventListener calls so that the events occur in the following order.
the_div! the_item! the_list!
*/
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, true);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, false);
var logCar = function(o) {
return console.log('I\'m a '+o.color+' '+o.make);
}
// logCar({ color: 'blue', make: 'BMW' });
var Car = function(make, color) {
this.make = make;
this.color = color;
(function(container){
var index;
function log(){
console.log(index);
}
function iterate(){
log();
@steffanwilliams
steffanwilliams / TypeKitEmbed.js
Created October 20, 2010 10:49
TypeKit for iOS 4+
var ua = navigator.userAgent;
var m = RegExp(/OS\s([\d+_?]*)\slike/i).exec(ua);
var version = m != null ? m[1].replace(/_/g, '.') : 4;
if (!(ua.match(RegExp('/ip(hone|ad|od)/i'))) || (ua.match(RegExp('/ip(hone|ad|od)/i')) && version >= 4)) {
try{Typekit.load();}catch(e){}
}
<?php
...
function textpattern()
{
...
$html = @file_get_contents(txpath.'/../templates/pages/'.doSlash($pretext['page']).'.php');
<?php
...
function fetch_form($name)
{
static $forms = array();
if (isset($forms[$name]))
$f = $forms[$name];
<?php
...
function txp_die($msg, $status='503')
{
...
if (@$GLOBALS['connected']) {