Skip to content

Instantly share code, notes, and snippets.

View jaspertandy's full-sized avatar

Jasper jaspertandy

View GitHub Profile
import { Controller } from "stimulus"
export default class extends Controller {
// this method is called when Stimulus attaches this
// class to an instance of a controller. It's like a
// constructor but I think it's when all the setup is done
// and we're ready to get started. That's how I use it anyway!
connect() {
this.updating = false // by default, we're not updating anything
this.timer = false // when updating on keypresses, we only do this on a timeout to reduce the number of requests sent
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[**.js]
indent_style = tab
// -------------------------------------
// if some butthead doesn't return
// the array from their extension
// we need a backup here or everything
// busts.
// -------------------------------------
@jaspertandy
jaspertandy / Freeform_notifications.php
Created September 13, 2013 16:48
In method send_notification() at line 309
if ( ! empty($order_ids))
{
//this makes sure that any fields in 'fields' are in the
//order set as well. Will add missing at the end like this
$field_loop_ids = array_merge(
$order_ids,
array_diff($field_loop_ids, $order_ids)
);
} else {
$layout = $this->composer_field_order( $form_data['form_id'] );
@jaspertandy
jaspertandy / mcp.freeform.php
Created September 13, 2013 16:46
in method visible_columns()
$default_hide = array('site_id', 'entry_id', 'complete');
foreach ($default_hide as $hide_me_seymour)
{
if (in_array($hide_me_seymour, $visible_columns))
{
unset(
$visible_columns[
array_search(
$hide_me_seymour,
@jaspertandy
jaspertandy / mcp.freeform.php
Created September 13, 2013 16:50
in method edit_entry()
if ($form_data['field_order'] !== '')
{
$order_ids = $this->actions()->pipe_split($form_data['field_order']);
if ( ! empty($order_ids))
{
//this makes sure that any fields in 'fields' are in the
//order set as well. Will add missing at the end like this
$field_loop_ids = array_merge(
$order_ids,
public function composer_field_order( $form_id ){
$composer = ee()->db->select('composer_id')
->where('form_id' , $form_id)
->get('freeform_forms')
->row()
->composer_id;
$layout = ee()->db->select('composer_data')
->where('composer_id' , $composer)
->get('freeform_composer_layouts')
word count
going 1081
love 1055
much 759
need 725
thing 705
something 695
fucking 687
right 669
great 667
#!/usr/bin/env ruby
require 'nokogiri'
file = File.expand_path '~/../Dropbox/Public/2012.xml'
xml = Nokogiri::XML( File.new( file ) );
albums = xml.xpath '//key[. = "Album"]'
all = []
@jaspertandy
jaspertandy / gist:4225180
Created December 6, 2012 15:13
PHP being cray.

Only use ===

php -r 'var_dump( "A box of spanners" == 0 ); var_dump( "A box of spanners" == true ); var_dump( 0 == true );'

bool(true) bool(true) bool(false)