Skip to content

Instantly share code, notes, and snippets.

View slopeofhope81's full-sized avatar

Steve Lim slopeofhope81

View GitHub Profile
@slopeofhope81
slopeofhope81 / README.md
Created February 5, 2018 21:32
Sequelize + Express + Migrations + Seed Starter
@slopeofhope81
slopeofhope81 / gist:9958702
Last active August 29, 2015 13:58
autotab()
function autotab(orig,dest){
if (orig.getAttribute&&orig.value.length==orig.getAttribute("maxlength"))
dest.focus();
}
74 console.debug('before autotab');
75 $(document).ready(function() {
76 $('.at1').autotab();
77 $('.at2').autotab();
78 });
@slopeofhope81
slopeofhope81 / gist:9743335
Created March 24, 2014 16:08
brushing up python #2
storage = {}
storage["first"]={}
storage["middle"]={}
storage["last"]={}
me = "steve seung lim"
storage["first"]["steve"] = me
storage["middle"]["seung"] = me
@slopeofhope81
slopeofhope81 / gist:9695283
Created March 21, 2014 20:09
review python #1
pyg = 'ay'
original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word[1:] + first + pyg
print new_word
else:
@slopeofhope81
slopeofhope81 / gist:9667647
Created March 20, 2014 16:19
creating a secret random key using ruby
def secure_token
token_file = Rails.root.join(".secret")
if File.exist?(token_file)
File.read(token_file).chomp
else
token = SecureRandom.hex(64)
File.write(token_file, token)
token
end
end
@slopeofhope81
slopeofhope81 / gist:9643973
Created March 19, 2014 15:20
sharing properties using literal object and constructor
var steve = {
name: "Steve",
};
var haeseong = {
name: "haeseong",
};
var protoRun = {
run: function(name){
@slopeofhope81
slopeofhope81 / gist:9487504
Created March 11, 2014 14:57
my first intro to Jasmine
describe("calculator",function(){
var calc;
beforeEach(function(){
calc = new Calculator();
})
describe("addition", function(){
it("should be able to add a sum", function(){
var result = calc.addition(5,3);
expect(result).toBe(8);
});
@slopeofhope81
slopeofhope81 / gist:9477929
Created March 11, 2014 01:38
my first clock watch app using angular
<script>
var myApp = angular.module('myApp', []);
myApp.controller("myFirst", function($scope){
$scope.clock = new Date();
var updateClock = function(){
$scope.clock = new Date();
}
setInterval(function(){
$scope.$apply(updateClock);}, 1000);
updateClock();
@slopeofhope81
slopeofhope81 / gist:9256983
Created February 27, 2014 19:12
my last project
$(document).ready(function(){
var allQuestions= [];
var questionNumber = 0;
var score = 0;
var name=[];
allQuestions[0]={question:"What is 2 + 2?",
choices:[0,2,3,4],
correct:3 };
allQuestions[1]={question:"What is 2 * 2?",
choices:[0,2,3,4],
@slopeofhope81
slopeofhope81 / gist:9228436
Created February 26, 2014 12:10
validation example using javascript/
<html>
<head>
<title>example javascript</title>
</head>
<body>
<form name="logInForm" method="post" onsubmit="return validate()">
First name:<input type="text" id="firstName" name="firstName" >
Last name:<input type="text" id="lastName" name="lastName" >
<input type="submit" value="LogIn" id="logIn">////<---------this type comes in pair with onsubtmit attribute!!!
<div id="error"></div>