This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* JetFormBuilder has no documentation about what hooks they fire or when they fire them. | |
* | |
* I ended up digging into their source code to try and find an action that fires for all | |
* form submission, even if they don't have a custom "post submit action" set up. | |
* | |
* Using jet-form-builder/form-handler/after-send gets the job done. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This uses the wp option "gmt_offset" as "timezone_string" is not always defined | |
class Timezone | |
{ | |
public static function utc_offset() | |
{ | |
return '+00:00'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const users = [{ | |
name: 'Andrew', | |
age: 26 | |
}, { | |
name: 'Jen', | |
age: 28 | |
}]; | |
const foundUser = users.find((user) => user.name === 'Andrew'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
app.get('/', (req, res) => { | |
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress; | |
console.log('IP', ip); | |
console.log('Request object', req); | |
res.json({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var someName = { | |
balance: 0 | |
}; | |
function deposit(account, amount){ | |
account.balance += amount; | |
} | |
function withdraw(account, balance){ | |
account.balance -= balance; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'TOGGLE_TODO': | |
return state.map((todo) => { | |
if (todo.id === action.id) { | |
var nextCompleted = !todo.completed; | |
return { | |
...todo, | |
completed: nextCompleted, | |
completedAt: nextCompleted ? moment().unix() : undefined | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add (a, b) { | |
return a + b; | |
} | |
add; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react'); | |
var ReactDOM = require('react-dom'); | |
var expect = require('expect'); | |
var $ = require('jQuery'); | |
var TestUtils = require('react-addons-test-utils'); | |
var Countdown = require('Countdown'); | |
describe('Countdown', () => { | |
it('should exist', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var https = require('https'); | |
var express = require('express'); | |
var app = express(); | |
var options = { | |
key: fs.readFileSync('./file.pem'), | |
cert: fs.readFileSync('./file.crt') | |
}; | |
var serverPort = 443; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var users = [{ | |
name: 'Andrew' | |
}]; | |
var user = users[0]; | |
user.name = 'Mike'; | |
console.log(users); // [ { name: 'Mike' } ] |
NewerOlder