Skip to content

Instantly share code, notes, and snippets.

View wolfieorama's full-sized avatar
🎯
Focusing

wolfieorama

🎯
Focusing
  • Nairobi, Kigali and else where
View GitHub Profile
// this script computes the fraction of passwords guessed after a certain number of guesses
import argparse
parser = argparse.ArgumentParser(description='Computing lambda')
parser.add_argument('data', type=str,
help='data file with frequency against the password')
args = parser.parse_args()
guessing = [g.strip() for g in open(args.data, encoding='utf-8', errors='ignore')]
// This program prints a
// @author John W Munyi
import java.util.Scanner;
public class Triangle
{
public static void main(String[] args)
{
int num;
String myshape;
class User < ActiveRecord::Base
include UserState
include Filterable
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable
validates :first_name, :last_name, :email, :phone_number,
:postal_code, :physical_address, :alternative_email, presence: true
ENV.serviceWorker = {
 enabled: true,
 debug: true,
 precacheUrls: [‘/staticResource’]
 excludePaths: [‘manifest.appcache’],
 fallback: [‘/online.html /offline.html’]
 swIncludeFiles: [
 ‘bower_components/pouchdb/dist/pouchdb.js’
 ]
 };
Installing pg 0.18.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/john/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/pg-0.18.3/ext
/home/john/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160822-26804-1r3jbzc.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
<div class="col-md-8 col-md-offset-1">
<div class="panel panel-default">
<%= form_for(@weekly_performance_review) do |f| %>
<% if @weekly_performance_review.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@weekly_performance_review.errors.count, "error") %> prohibited this weekly_performance_review from being saved:</h2>
<ul>
<% @weekly_performance_review.errors.full_messages.each do |message| %>
<li><%= message %></li>
function buildAirlineTicketMaker(tclass){
return function(name){
alert("Here is your flight ticket via the " + tclass + ".\n" +
"Welcome to Luxury, " + name + "!");
}
}
var getFirstClassTicket = buildAirlineTicketMaker("First class");
var getBusinessClassTicket = buildAirlineTicketMaker("Business class");
function buildAirlineTicketMaker(tclass){
return function(name){
alert("Here is your flight ticket via the " + tclass + ".\n" +
"Welcome to luxury, " + name + "!");
}
}
var getFirstClassTicket = buildAirlineTicketMaker("First class");
var getBusinessClassTicket = buildAirlineTicketMaker("Business class");
function buildAirlineTicketMaker(tclass){
return function(name){
alert("Here is your flight ticket via the " + tclass + ".\n" +
"Welcome to luxury, " + name + "!");
}
}
function testClosure (){
var x = 4;
function closeX(){
return x; // NB: x is not stored anywhere in the innermost function its a global variable
}
return closeX;
}
var checkLocalX = testClosure();