Skip to content

Instantly share code, notes, and snippets.

@rizqidjamaluddin
rizqidjamaluddin / User.php
Created October 26, 2015 03:49
Base set of classes for more complex features - NOT a "pattern" to be followed like you will be cursed for not adhering to, if you use an unnecessary factory I will hunt you down with a super soaker
<?php
/**
* @property int $id
* @property string $email
* @property string $password
* @property Carbon $created_at
*/
class User extends Model {
@travisulrich
travisulrich / international.xml
Created June 24, 2015 18:23
Update USPS shipping in Lemondstand - Rates to Canada with origin ZIP
<IntlRateV2Request USERID="<?= h($user_id) ?>">
<Revision>2</Revision>
<Package ID="PACKAGE">
<Pounds><?= h($pounds) ?></Pounds>
<Ounces><?= h($ounces) ?></Ounces>
<Machinable><?= $machinable ? 'true' : 'false' ?></Machinable>
<MailType>Package</MailType>
<ValueOfContents><?= $total_price ?></ValueOfContents>
<Country><?= $country ?></Country>
<? if (strlen($container)): ?>
@jefftriplett
jefftriplett / trello-to-newsletter.py
Last active June 5, 2021 17:00
Trello to Newsletter builder
"""
Trello to Newsletter builder
This is heavily inspired by: https://changelog.com/trello-as-a-cms/
To install:
pip install click cached_property markdown py-trello
To run:
export TRELLO_APP_KEY=''
@adamwathan
adamwathan / v-cloak.md
Last active November 6, 2024 14:28
Useful CSS utilities for Vue.js cloaking

Handy helpers for controlling visibility of elements until Vue has compiled.

Use like:

<div v-cloak>
  <h1>
    <span class="v-cloak--inline">Loading...</span> <!-- Only displayed before compiling -->
    <span class="v-cloak--hidden">{{ post.title }}</span> <!-- Hidden until compiling is finished -->
 
@paulirish
paulirish / bling.js
Last active February 18, 2025 14:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@cvrebert
cvrebert / css_regression_testing.md
Last active March 30, 2025 19:49
Survey of screenshot-based CSS testing tools

Currently considering https://github.com/webdriverio/webdrivercss


Core Goals:

  • Can test in up-to-date versions of all major browsers
  • Can test on up-to-date versions of all major OSes
  • Can test in IE9 (because Bootstrap v4 will support IE9+)
  • Don't want to have to setup/maintain our own cluster of VMs running all the necessary OSes (and all the versions of Windows)
  • Workflow for management of reference/baseline/norm screenshots
@nicomollet
nicomollet / wp_auto_install.sh
Last active October 23, 2024 23:23
WP-CLI auto install script
#!/bin/bash
# Default options
LOCALE="fr_FR"
DB_HOST='localhost'
VIRUSTOTAL_KEY='YOUR_KEY'
printf "Name of the project? cf My Project: "
read PROJECT_NAME
@kristianfreeman
kristianfreeman / capture.rb
Created September 26, 2014 03:42
Downloading NPR "First Listen" albums
require 'nokogiri'
require 'open-uri'
# for url - http://ask.metafilter.com/187877/How-to-download-audio-from-NPR-stream
url = 'http://api.npr.org/query?id=1039&fields=titles,audio,show&sort=assigned&apiKey=MDAzMzQ2MjAyMDEyMzk4MTU1MDg3ZmM3MQ010'
doc = Nokogiri::XML(open(url))
doc.xpath('//mp3').each do |file|
url = file.text.strip
if url.include?("/fl/") && url.include?('.mp3') # Is it a "first listen" mp3?
#!/bin/bash
# Add Vagrant's hostupdater commands to sudoers, for `vagrant up` without a password
# force sudo on self.
if [ $( id -u ) -ne 0 ]; then
exec sudo -p "Login password for %p: " "$0" "$@"
exit $?
fi
# Stage updated sudoers in a temporary file for syntax checking