Install Node.js https://nodejs.org
Using terminal in this folder, run:
npm install -g bower
bower install
npm install
| 'use strict'; | |
| var head = null; // head of linked list | |
| function addNode(val) { | |
| var node = { | |
| val: val, | |
| next: null | |
| } |
| 'use strict'; | |
| var hashSize = 3; // small so we get collisions | |
| var hashArray = new Array(hashSize); | |
| var bigPrime = 1223; | |
| function calculateHash(key) { | |
| var hash = 0; | |
| if(key.length > 0){ | |
| for (var i = 0; i < key.length; i++) { |
| 'use strict'; | |
| // Infinite scrolling loader, fires off a button click | |
| // | |
| // Sample HTML: | |
| // <div class="js-infinite-scroll"> | |
| // POSTS HERE | |
| // <a href="/url-to-more-content" class="js-infinite-scroll-next-button">Load More</a> | |
| // </div> | |
| // <div class="js-infinite-scroll-loading">...</div> |
Install Node.js https://nodejs.org
Using terminal in this folder, run:
npm install -g bower
bower install
npm install
| <?php | |
| // * | |
| // Show Alternate ID column in admin | |
| // * | |
| add_filter('manage_posts_columns', 'add_alternate_id_columns', 10, 2); | |
| function add_alternate_id_columns($posts_columns, $post_type) | |
| { | |
| if( $post_type == 'offer-download' ) { | |
| $posts_columns['offer_download_id'] = 'Internal ID'; |
| class ApplicationController < ActionController::Base | |
| # Prevent CSRF attacks by raising an exception. | |
| # For APIs, you may want to use :null_session instead. | |
| protect_from_forgery with: :exception | |
| before_filter :check_domain_and_ssl | |
| def check_domain_and_ssl | |
| if Rails.env.production? and (request.protocol.downcase + request.host.downcase) != 'https://www.mywebsite.com' | |
| redirect_to 'https://www.mywebsite.com' + request.fullpath |
| #!/bin/bash | |
| #echo on | |
| set -x | |
| echo load postgres | |
| sudo defaults write /Library/LaunchDaemons/org.macports.postgresql94-server.plist Disabled -bool false | |
| sudo launchctl load /Library/LaunchDaemons/org.macports.postgresql94-server.plist | |
| echo start redis |
| class func setupNotificationFor(hourTask:HourTask) { | |
| // clear all old notification first if there is one | |
| for notification in UIApplication.sharedApplication().scheduledLocalNotifications as! [UILocalNotification] { | |
| if (notification.userInfo!["UUID"] as! String == hourTask.theID) { | |
| UIApplication.sharedApplication().cancelLocalNotification(notification) | |
| println("old notification removed") | |
| break | |
| } | |
| } |
| <html> | |
| <head> | |
| <title>Down for maintenance</title> | |
| <style> | |
| body { background: #444; color: #eee; padding: 3em 2em; text-align: center; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; } | |
| </style> | |
| </head> | |
| <body> |
| import UIKit | |
| class myClass { | |
| var myVal = 1 | |
| } | |
| func addVals(myClasses: [myClass]) -> Int { | |
| var result = 0 | |
| for thisClass in myClasses { | |
| result += thisClass.myVal |