Skip to content

Instantly share code, notes, and snippets.

View shomanishikawa's full-sized avatar

Shoma Nishikawa shomanishikawa

View GitHub Profile
try:
selenium.find_element_by_css_selector(FUNCTIONS_MODULE_SELECTOR))
except NoSuchElementException:
# CODE HERE IF ELEMENT DOES NOT EXIST
else:
# CODE HERE IF ELEMENT EXISTS
@shomanishikawa
shomanishikawa / sequelize-migration-file-generator.js
Created July 25, 2017 00:22 — forked from manuelbieh/sequelize-migration-file-generator.js
Creates migration files for existing sequelize models
import * as models from "models";
import fs from "fs";
for(let model in models) {
let attributes = models[model].attributes;
for(let column in attributes) {
delete attributes[column].Model;
delete attributes[column].fieldName;
@shomanishikawa
shomanishikawa / slugify.js
Created July 22, 2017 16:12 — forked from mathewbyrne/slugify.js
Javascript Slugify
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
}
@shomanishikawa
shomanishikawa / osx-for-hackers.sh
Last active September 12, 2015 07:36 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@shomanishikawa
shomanishikawa / pu.sh
Last active September 9, 2015 12:57 — forked from AsianChris/pu.sh
Git Repo Update
#!/bin/bash
# View Delimiter
DLM='-------------------------------------'
# Set Output Colors
red=`tput setaf 1`
green=`tput setaf 2`
blue=`tput setaf 4`
cyan=`tput setaf 6`
@shomanishikawa
shomanishikawa / jquery.animateAuto.js
Last active December 31, 2015 03:29
jQuery animate to auto height/width
jQuery.fn.animateAuto = function(prop, speed, callback){
var elem, height, width;
return this.each(function(i, el){
el = jQuery(el), elem = el.clone().css({"height":"auto","width":"auto"}).appendTo(el.parent());
height = elem.css("height"),
width = elem.css("width"),
elem.remove();
if(prop === "height")
el.animate({"height":height}, speed, callback);
Started GET "/shoma86" for 127.0.0.1 at 2012-10-04 14:54:01 -0400
Processing by UsersController#show as HTML
Parameters: {"id"=>"shoma86"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."username" = 'shoma86' LIMIT 1
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 53 LIMIT 1
TwitterAccount Load (0.1ms) SELECT "twitter_accounts".* FROM "twitter_accounts" WHERE "twitter_accounts"."user_id" = 53 LIMIT 1
FacebookAccount Load (0.1ms) SELECT "facebook_accounts".* FROM "facebook_accounts" WHERE "facebook_accounts"."user_id" = 53 LIMIT 1
YoutubeAccount Load (0.1ms) SELECT "youtube_accounts".* FROM "youtube_accounts" WHERE "youtube_accounts"."user_id" = 53 LIMIT 1