Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Delgado anthonydelgado

View GitHub Profile
View php
<?php
$fields = CFS()->get( 'sections' );
foreach ( $fields as $field ) { ?>
<div class="full-width bg-light-grey">
<div class="content-container content-section">
<div class="full-width-flex">
<div class="vh-container" style="background: url('<?php echo $field['image']; ?>') center no-repeat; background-size: cover">
</div>
View theory_of_learning.md

How Dev Bootcamp Teaches: ActiveRecord

I'm Jesse, one of the co-founders of Dev Bootcamp, and the acting curricular editor-in-chief. We get lots of questions about how Dev Bootcamp approaches teaching, what our curriculum is like, and how it differs from other schools and competitors. I thought I'd share some of that with you, starting with a brief overview of our theory of learning and then sharing our introduction to ActiveRecord.

Update As of August, 2013, I'm no longer at Dev Bootcamp. I'm now working on CodeUnion to help people learn new technical skills without putting their lives on hold. I wrote everything below myself and I can't actually vouch for whether any of it reflects DBC's current approach. It definitely reflects our approach at CodeUnion, though. If you want to know more, please reach out: jesse@codeunion.io :)

This will be light on theory and hea

View slugify
//function to slugify a name
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, ‘-’) // Replace spaces with -
.replace(/[^\w\-]+/g, ‘’) // Remove all non-word chars
.replace(/\-\-+/g, ‘-’) // Replace multiple - with single -
.replace(/^-+/, ‘’) // Trim - from start of text
.replace(/-+$/, ‘’); // Trim - from end of text
}
@anthonydelgado
anthonydelgado / heroku force https
Created Jul 2, 2017
Force SSL / HTTPS on heroku production server
View heroku force https
function requireHTTPS(req, res, next) {
// The 'x-forwarded-proto' check is for Heroku
if (!req.secure && req.get('x-forwarded-proto') !== 'https' && process.env.NODE_ENV == "production") {
return res.redirect('https://' + req.get('host') + req.url);
}
next();
}
View giantuser_signature.html
<body>
<br />
<br />
<br />
<style type='text/css'>
a.link{margin:0;padding:0;border:none !important;text-decoration:none !important;}
table,tr,td,a,span{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;}
</style>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<meta name='format-detection' content='telephone=no' />
View div.scroll
div.scroll {
background: url(../../assets/img/aems_website_banner_scroll.png) left no-repeat;
height: 64px;
width: 86px;
margin: 0 auto;
position: fixed;
bottom: 10%;
left: 50%;
margin-left: -43px;
z-index: 99112;
View constructor node
var Dud = function(gender, dudName, coolnessScale){
this.gender = gender
this.dudName = dudName;
this.coolnessScale = coolnessScale;
this.dudeOrDudess = function(){
if (this.gender == 'female'){
console.log("I'm a dudess. Sup?");
}else{
console.log("I'm a dude. Are there any dudesses around?");
}
View switch statement in node
var action = process.argv[2];
// We will then create a switch-case statement (if-then would also work).
// The switch-case will direct which function gets run.
switch(action){
case 'total':
total();
break;
case 'deposit':
View Native System UI Web Fonts
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
View Adding Emoji to your terminal
sublime ~/.bash_profile
Add this line
PS1="\W 🔥 "
Save and Exit
Restart Terminal
Enjoy!