Skip to content

Instantly share code, notes, and snippets.

View marcusshepp's full-sized avatar
🎯
Focusing

Marcus Shepherd marcusshepp

🎯
Focusing
View GitHub Profile
mkmanagementcommand(){
# creates a new management command
# arg1: app name
mkdir $1/management;
touch $1/__init__.py;
mkdir $1/management/commands;
touch $1/management/commands/__init__.py;
touch $1/management/commands/$2.py;
}
add_ci(){
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}
// sleep(1000);
@marcusshepp
marcusshepp / is_ascii.js
Created May 2, 2016 15:06
Javascript check for non-ascii chars
function is_ascii(str){
for (var i = 0; i < str.length; i++)
if (str.charCodeAt(i) > 127)
return false;
return true;
}
@marcusshepp
marcusshepp / google_fonts.html
Created May 3, 2016 16:03
google fonts example
<!-- html -->
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family=Lato">
<!-- css -->
body{
font-family: 'Lato', serif;
font-size: 110%;
}
.foo{
animation: foo_ani 1s;
}
@keyframes foo_ani{
0%{
background-color: #53E889;
}
100%{
background-color: #AAF9C6;
@marcusshepp
marcusshepp / find_a_file.sh
Created May 11, 2016 17:22
Find a file in bash
find / -name foo.bar
@marcusshepp
marcusshepp / gen_pub_key.sh
Created May 13, 2016 12:35
generating a public ssh-key on Mac OS X
ssh-keygen -t rsa && cat ~/.ssh/id_rsa.pub
<!-- button to delete an object -->
<% @foo.each do |f| %>
<%= button_to 'delete', f, method: :delete %>
<% end %>
@marcusshepp
marcusshepp / js_event_from_doc.js
Last active May 26, 2016 18:03
Javascript Event on Non-existent Element
$(document).on("mouseenter", ".foo", function(){
console.log("do something");
});
// for jquery versions < 1.7
$(".foo").live("click", function(){
console.log("do something");
});
@marcusshepp
marcusshepp / css_mouse_detection.css
Created May 26, 2016 18:58
css onmouseenter, onmouseout
/* on mouse enter */
.foo:hover{
}
/* on mouse out */
.foo:not(:hover){
}