Skip to content

Instantly share code, notes, and snippets.

View kingsidharth's full-sized avatar
💭
I may be slow to respond.

King Sidharth kingsidharth

💭
I may be slow to respond.
View GitHub Profile
@kingsidharth
kingsidharth / knex.column.deleted.js
Last active November 29, 2017 01:36
Knex.js Gotchas!
/* SINPPET FOR DELETED & DELETED AT SUPPORT IN KNEX.JS
inspired from Sequlize.js 'paranoid' schema option,
don't delete rows from database, ever.
*/
/* In Table Definition */
knex.schema.createTable('TABLE_NAME', function(table) {
table.boolean('deleted').defaultsTo(false).notNullable();
table.dateTime('deleted_at');
@kingsidharth
kingsidharth / Lesson_1.markdown
Created November 5, 2012 23:30
Editing Lesson 1

Our Philosophy

The best way to learn a technology is to do (pracice) the techinque. Be it painting, architutre, programming or building an application (app) - getting hands in the clay is the way to go.

But to excpect a new art student to make a portrait is stupid. There are too many details and it get's overwhelming. And soon bad results take away the enthusiasm. Unfortunately, most programming books ask new users to make portraits before teaching them basics. Basics isn't about syntax or philosophy of a programming language but building the app.

We foucs on basics that get you off and running.

Good tools are indespensible for good artists. They don't really change or transform your art but aid you create better art by letting you focus on meaningful details.

Frameworks are indespensible tools of the programming world. Ruby on Rails is one such framework, it aids you to build your apps faster by automating many things. Learning a framework will get you started on real work faster than learning a langua

<?php
/*class TM_Loop extends thesis_custom_loop {
function home() {
thesis_loop::home();
}
}*/
//$loopty_loop = new tm_loop_home;
<?php
$loopty_loop = new my_loops;
class my_loops extends thesis_custom_loop {
function home() {
echo "<div class=\"post_box top\">\n";
echo "\t<div class=\"format_text\">\n";
echo "\t\t<ul>\n";
while (have_posts()) {
@kingsidharth
kingsidharth / math_power.js
Created March 30, 2012 12:56
Calculate power of something in js
var power = function (base, exponent) {
if(exponent === 0) {
return 1;
} else {
var result = 1;
for (var i = 0; i < exponent; i++) {
result = result * base;
}
return result;
}
@kingsidharth
kingsidharth / custom.css
Created March 27, 2012 09:43
For kingsidharth.com
.custom .page {
background: none;
font-family: Helvetica Neue, Helvetica, Lucida Grande, Lucida Sans, Verdana, sans-serif; }
.custom {
background: url("images/background-noise.png") top center repeat; }
#header_area {
background: url("images/top-border-background.png") top center repeat-x; }
#header_area #header {
@kingsidharth
kingsidharth / Breadcrubms.php
Created March 25, 2012 05:40
Modified from Hybrid
<?php /**
* Breadcrumb Trail - A breadcrumb menu script for WordPress.
*
* Breadcrumb Trail is a script for showing a breadcrumb trail for any type of page. It tries to anticipate
* any type of structure and display the best possible trail that matches your site's permalink structure.
* While not perfect, it attempts to fill in the gaps left by many other breadcrumb scripts.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU
* General Public License version 2, as published by the Free Software Foundation. You may NOT assume
* that you can use any other version of the GPL.
function authors_orderBy($data, $field){
$code = "if (\$a['$field'] == \$b['$field']) {return 0;} return (\$a['$field'] < \$b['$field']) ? 1 : -1;";
usort($data, create_function('$a,$b', $code));
return $data;
}
function author_list(){
if(is_page('the-team')) {
$blogusers = get_users_of_blog();
if ($blogusers) {
$au = array();
@kingsidharth
kingsidharth / deaf_grandma.rb
Created October 3, 2011 16:52
Shout at her in caps
puts "Talk to Grandma"
you_said = 'not'
while you_said != 'BYE'
if you_said == you_said.upcase
puts "Nah! Not since " + 1950+rand(50).to_s + " !"
else
puts "HUH? SPEAK UP! LOUNDER!"
end
you_said = gets.chomp