Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View robbiegod's full-sized avatar
🧛‍♂️

Robert Fletcher robbiegod

🧛‍♂️
View GitHub Profile
@claytongulick
claytongulick / template.js
Last active June 25, 2022 23:32
if statement inside string template literals and lit-html.
//a quick example of how to use actual 'if' statements inside template literals,
//without using ternary operator. Sometimes this is cleaner if you have complex conditionals or nested conditionals.
//data param is passed in via render(template(data), this) - if not using lit-html, could be any function
template = (data) => html`
<div id="job_edit" class="modal">
<div class="modal-content">
${
//we're just going to wrap an anonymous inline function here and then call it with some data
(job => { //job here, is just an example, it could be anything, it's passed in below in (data.job)
if(job)
/* ----------- Galaxy S3 ----------- */
/* Portrait and Landscape */
@media screen
and (device-width: 320px)
and (device-height: 640px)
and (-webkit-device-pixel-ratio: 2) {
}
@juanbrujo
juanbrujo / jquery.checkboxes-events.js
Last active February 23, 2016 18:51
jQuery checkboxes attach event on change state
// react then checkbox change state
$('input[type="checkbox"]').on('change', function(e) {
if( this.checked ) {
console.log('checked');
} else {
console.log('not checked');
}
});
// check
<%@ WebHandler Language="C#" Debug="true" Class="name" %>
using System.Web;
public class name : IHttpHandler {
public void ProcessRequest (HttpContext context) {
}
public class BATTLEFRONT {
public static void main(String[] args) {
int age = 21;
System.out.println(oldEnough(age));
}
static boolean oldEnough(int age) {
<tile version='3'>
<visual branding='nameAndLogo'>
<binding template='TileMedium'>
<text hint-wrap='true'>New movies available</text>
<text hint-wrap='true' hint-style='captionSubtle'/>
</binding>
<binding template='TileWide'>
<text hint-wrap='true'>New movies available</text>
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active March 13, 2024 17:43
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@mattradford
mattradford / licence activation.php
Last active October 28, 2023 19:25
ACF5 Pro licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.
// Place this in wp-config
define( 'ACF_5_KEY', 'yourkeyhere' );
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function auto_set_license_keys() {
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) {
$save = array(
'key' => ACF_5_KEY,
@mattclements
mattclements / function.php
Last active April 16, 2024 17:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@awhites
awhites / nest.js
Created October 22, 2015 14:26
Test
var a = {
b: {
c: "nested!"
}
}
console.log(a.b.c);